MTBlogTimes

Inspired by Brad
Chaote
and Adam
Kalsey
‘s never-say-not-possible MT plugins, I came up with a wierd thought
of plotting the post times of my blog in a timespan of 24 hours. And I knew
it might not be impossible, even though I had never ever peeked into the MT
code and plugin API. And here I am, after 3 days of poking and probing through
MT plugin API and Brad and Kalsey’s plugins. This goes miles to prove how very
well Ben Trott has created the MT API. They are damn easy to code!

MTBlogTimes creates a chart which plots the time of your posts(in
a specified period) on a bar of the 24 hours of the day. I haven’t found any
apparent advantage of doing so. Well, probably someone will devise a way of
using this too. Say like, analysing the blog patterns for various blogs (provided
everyone shared their blogtimes) .. or like finding out a true blogomaniac,
a person who blogs all day… Nevertheless the resulting graphic looks cool. Check it out –

MTBlogTimes


You can download this plugin here: mtblogtimes-1.0.tar.gz
or mtblogtimes-1.0.zip


Prerequisites


This plugin has been tested on MovableType
v2.51
but should work on versions >= 2.2. Also, it requires the Perl
GD module. I have tested the plugin using GD v1.4. You should not have any problem
with newer versions.


Installation


Extract the tar-gzip or the zip file and copy the plugin to the MT plugins
folder.


(mt home)/plugins/blogtimes.pl


Description


This plugin allows you to plot the time of your posts in a given period in
the form of a timeline bar.


Tags made available through this plugin:



  • <MTBlogTimes>: Container tag for bar/pie creation.

  • <MTBlogTimesWidth>: Returns the width of the image.
    This is not the same as the width you specify in the tag attributes. This
    is because the bar is padded additionally for writing the text.
  • <MTBlogTimesHeight>: Returns the height of the image.
    This is not the same as the height you specify in the tag attributes. This
    is because the bar is padded additionally for writing the text.
  • <MTBlogTimesFilename>: Returns the filename of the
    image
  • <MTBlogTimesFullFilename>: Returns the complete path
    of the image
  • <MTBlogTimesFileURL>: Returns the URL created for
    the image.

Tag Attributes for <MTBlogTimes>

width: This allows you to specify the width of the timeline
bar in pixels. This is not the final width of the image because padding will
be added to this to put the text. If you do not specify this, the value defaults
to 400.
height: This allows you to specify the height of the timeline
bar in pixels. If you do not specify it, the value defaults to 30.
name: Allows you to specify the name of the image that will
be created. The default value is `blogtimes’.
save_dir: This attribute allows you to alternatively specify
a sub-directory under <MTBlogSitePath> where you can store the generated
image. This directory should be write-accessible to MT or the file won’t get
created.
linecolor: This allows you to customise the colour of the plot
lines on the bar. Specify this color in hex format e.g. #RRGGBB. The default
value is #FFFFFF
textcolor: This allows you to customise the colour of the text
on the bar. Specify this color in hex format e.g. #RRGGBB. The default value
is #757575
fillcolor: This allows you to customise the colour of the bar
background. Specify this color in hex format e.g. #RRGGBB. The default value
is #757575
bordercolor: This allows you to customise the colour of the
border of the image. If you want to turn off the border, simply specify the
color of your page background. Specify this color in hex format e.g. #RRGGBB.
The default value is #757575
padding: This allows you to control the padding around the
timeline bar. The default is 5px.

show_text: This allows you to shut off the text and keep only
the bar.
month: this allows you to specify the month for which to plot
the timeline. You need to specify thi sin the format YYYYMM. e.g. November 2002
would be `200211’. If you do not specify this, the current month at the time
of rebuilding the page is taken.

Usage

When you rebuild a page containing <MTBlogTimes> tag, an image is generated
and stored on your server. You can link the image on the page or somewhere else.
Please note that the generated image is a PNG image with transparency set. If
you do not like transparent images, you’ll need to edit the script and remove
the appropriate line. Here’s an example of how you can use the <MTBlogTimes>
plugin -

Simple:

<MTBlogTimes>
<img
src="<$MTBlogTimesFileURL$>"
width="<$MTBlogTimesWidth$>"
height="<$MTBlogTimesHeight$>"
border="0"
alt="B L O G T I M E S"
title="B L O G T I M E S" />
</MTBlogTimes>
Customised:

<MTBlogTimes
fillcolor="#4a4a4a"
textcolor="#4a4a4a"
linecolor="#FFFFFF"
bordercolor="#4a4a4a"
width="400"
height="30"
save_dir="images"
show_text="on">
<a href="http://nilesh.org/mt/blogtimes/">
<img src="<$MTBlogTimesFileURL$>"
width="<$MTBlogTimesWidth$>"
height="<$MTBlogTimesHeight$>"
border="0" alt="B L O G T I M E S"
title="B L O G T I M E S" />
</a>
</MTBlogTimes>


B L O G T I M E S

Either you can paste this code directly on your page, or the cleaner way of
doing it is to create a Template Module called BlogTimes and including it on
the main page like this –


<$MTInclude module="BlogTimes"$>

Some cool things you can do:


* Save the timeline using the month as names – e.g. `http://nilesh.org/archives/images/blogtimes-2002-nov.png’.
You can do this by giving the filename as this


<MTBlogTimes name="<$MTDate format="blogtimes%Y-%b">">
<img src="<$MTBlogTimesFileURL$>"
alt="B L O G T I M E S"/></a>
</MTBlogTimes>

You can later reference these images in your monthly archives.


ToDo



  1. Allow more customisation of the period which is at present limited to a
    month. Probably a flexible period with start date and end date.

  2. Allow a vertical timeline bar for placing on your sidebar.

  3. Add another view, say something like a piechart.

  4. If you think there is something more you can suggest, mail me.

Support

If you have any problems installing this plugin or need help for installation,
post your problem to this MovableType Forum thread. Or you can put your questions
/ comments on this page.

Changelog

  1. 29/11/2002 – Released BlogTimes plugin.

License

This plugin is released under the MIT
License
.

Author

Nilesh Chaudhari (mail at nilesh.org)

29 Comments (closed)

On my setup, the date based example that you give above (to save the graphics over time) does not work. I have modified the source code so that the name parameter is passed through date format specification. In my modified implementation, you can simply have: <MTBlogTimes name="blogtimes-%Y-%m">. Do you want the code to generate a 1.1 version?
Of course, the HTML markup disappeared in my example. What I meant is name="blogtimes-%Y-%m" as a parameter to the MTBlogTimes parameter.
Emmanuel, thanks for bringing that to my notice. I had written the tip expecting that I'll enable the MT tag parsing. I finished the code without it and forgot about it. You can send me the code. I'll put it out with the 1.1 version with proper credits.
Sign me up for that 1.1 version
Oh wow, that's awesome. I think I'll wait for that. In the meantime, I think I can add an image map to the image without any hackery, since I just want to divide it into weeks: just section it into 4 quarters, create an image map template and get MT to fill in the links on a month by monthe basis. I'll tell you how it goes.
Nice suggestion, Kingsley. You know off late, I have received mails from people suggesting to turn blogtimes into an informational and navigational aid. I am working on a brand new MT3.0 version. If you want an immediate solution on something similar to what you need, try Srijith's hack of MTBlogtimes.
Hi, I keep getting the output : -- B L O G T I M E S -- The server reports an error that says : -- Can't load '/home/public_html/blog/extlib/GD.so' for module GD: /home/public_html/blog/extlib/GD.so: Shared object has no run-time symbol table at /usr/local/lib/perl5/5.8.1/mach/DynaLoader.pm line 229. -- Do you have any suggestions ?

Posted by
Gareth Edwards

27 December 2003 @ 9 PM

Is there any news on a fix for the name attribute to enable files to be saved each month with filenames based on the date? Aside from that small issue, great and interesting plugin idea, and looks terrific.
I love the idea of the BlogTimes but I've reset the module over and over again to get the name= attribute to work and it just won't. I only get the current month and then an extra "> prior to the image. HELP!! Please email me if you can help a sample of it would be http://www.whats-crackin.com/archives/2003_12.php if you go back a month or forward a month it just doesn't create the image. Or am I wrong that it can do this?
Im getting a similiar problem where the dates on the images do not match the current date. Is this still being looked into?
Does it use the server timezone to determine the date It doesn't need to. It simply picks up the date from the database and plots on the image. As far as the image going blank is concerned, Blogtimes behaves like any other plugin on the index page. Whenever the index page is rebuilt, either when a new post is made or when someone comments on your posts, blogtimes is executed and it generates a new image. If the month at the time of generation is June, Blogtimes will show June in the chart. You can observe the same on my index page now.
Then there's something wrong, because when I did mt rebuilt end of last month, it was around 8pm mountain time, however BlogTimes rolled over to June. From reading comments on here, I'm not the only one with this problem. The server is running in Mountain time, and my MT installation is running Mountain time. So then why did BlogTimes roll over to June when it wasn't June yet? I know MT's internals still work off of UTC (look at your activity log, and you'll see those aren't correct times, those are UTC times - at least on every MT installation I've seen they are), so maybe BlogTimes is doing the same?
Does it use the server timezone to determine the date? It's already switched to the June image on my site even though it's only 6:21pm here.
Same here. It's already showing June, when it's not anywhere close to midnight over here. Both the server, as well as my MT installation both are running on Mountain Time. And of course, it overwrote the old file, so there's no way to get the May image back up. And was the problem with creating different images based on <$MTDate format=...$> been resolved?
AMK4, you are right. I somehow managed to skip that. However, it would be a few days before I try to fix that as I am preoccupied. Any volunteers?

Posted by
Rick Zhang

05 April 2003 @ 11 PM

oh, sorry, it seems that this cool plugin can not work on my blog. It cannot generate the png file, and all the html codes turn out as follow: B L O G T I M E S I use the gd.pm u provide, i am sure that all the files are in the right place The version of my mt is 2.63
Any progress on a 1.1 version to fix the name attribute, or at least a work around? I'd love to use that attribute but so far can't get it to work. Thanks a bunch. Love the plugin. Now to just get my site totally converted to MT from my home grown code....

Posted by
Chandler

21 December 2002 @ 9 AM

Put me on the interested parties list for 1.1 as I got flumoxed by the date format thing too. Nice eye-candy btw
Yosshi, Take a look at the MTBlogtimes thread on Movabletype forum or at its homepage here -> http://nilesh.org/mt/blogtimes/ I have posted some precompiled perl modules. i doubt whether they will work on your server, but nevertheless try them out. Extract the files in the extlib folder.
innovation at work here :) the over outlook is cool now it timme to put it to my use ;) keep pluging!!
very cool plugin. I love how the graphic looks. vertical implementation would be nice, too. thanks. nice site, btw.
Ya, I want to do that. I have it in my TODO.
cool plugin! but i got a error massage as "Can't locate object method "png" via package "GD::Image" at plugins/blogtimes.pl line 131. " from MT when I'm going to rebuild INDEX template. what should I do? I am using dreamhost.com sharing sever.
Yosshi, can you find out the version of GD that your host has? Most probably it is an old version which does not produce PNG images. GD has since long removed GIF support because of licensing issues.
There is a test script in the source tarball of Perl::GD. You can use that to check the version. i.e. if you have telnet/ssh access to your server.
hello, Nilesh I asked to my host company about the version of the module. they answred like this; > We have 1.18 installed. If you need a newer version you can probably > either download it from the MT people and place it in your 'extlib' > directory under your main MT install (see MT support about this). > > If they don't have a version available, you can compile it yourself in > your home directory. It's for advanced users but will do exactly what you > want. i have no idea about compiling perl module. i want to ask you again that there is the way to use GD function with MT's 'extlib' directory. I really want to use the plugin, MTBlogTimes!
I love this. I have suggestions too: What if the image was sectioned by weeks and hotlinked to weekly archives? That would be cool, and move it beyond eye-candy to a navigational aid. I can imagine using this instead of my Monthly archive links, so people can reach directly for times when I posted more. What if the stripes where color-coded to indicate number of comments? I wouldn't make the stripes clickable (too fine a target) but a week seems like a decent enough target t select.
I've installed the Blogtimes plugin but It doesn't work I only see a little withe box (the plug in doesn't create a blogtimes.png image) I don't know how? Is there someone the want to help me? Thank you
I've intermittently created a PHP solution to the problems people are having with this plugin in MT 3.14. You can get it here.