My first Movable Type plugin -- RandomImage

    After two weeks of perl study and two days self-study of Movable Type plugin, I wrote a RandomImage plugin, which enable you to publish a random image to your blog items. How does the small picture looks at the left side of the title area? I defined a random image as an image url and a link url, when you click the image, it will open a new window and navigate to the linked url. If you want to implement this plugin, prepare an image list first, save them to a pure text file. As following:

# image_url#link_url

1.jpg#http://.....
2.jpg#http://.....

    Then insert the tag to the template file anywhere you want:

<$MTRandomImage file="path/imagelist.txt"$>

    Every time you rebuild your pages, or somebody post a comment which also result to rebuild the pages, will pick a random image, and insert the following HTML code to you article.

<a href="http://....." target="_blank">
<img src="1.jpg" border="0" />
</a>

    If you are familiar with perl, you could change the code. The idea is a little different with the implementation with Java script. The random is based on rebuild or comment. Enjoy it!

Post a comment

SCode:
Mail(*, but will not be displayed):
Home: