A Better Image Rotator

I have instituted the ‘Better Image Rotator’ by Dan Benjamin that appeared on A List Apart today.

Not being one to leave well enough alone, I added a line of code, only my second ever attempt in php to do something. I added a line in the images.ini file to each image that contained a descriptive sentence about the picture being displayed. For example…

desc = This is the picture description.

Then in the rotate.php file i added the following lines of code…

#add image description text
printf(
‘<p><strong>Pic Desc:</strong> %s</p>’,
$images[$img][‘desc’]
);

This, as you can see on the right, puts the small bit of description text just below the random image. So far i’m liking it.

If you asked me to explain what the code means, I wouldn’t be able to tell you yet. Because I don’t know. Like most programming languages that I have any knowledge of it all starts by manipulating existing code. Like i’ve done here.