Main Content

Image indexer / thumbnail display scripts in PHP

Archive - Originally posted on "The Horse's Mouth" - 2016-02-25 12:25:10 - Graham Ellis

I often say that example programs provided to show "how to" become too complex too quickly - going straight from the simplest of programs (a.k.a. a "hello world") though to something much more complex in a single leap. I take multiple steps as I proceed on our courses, and I try to make sure that I show sufficient intermediate steps when I post online; not always as easy as it seems, as online examples need to be robust. By that, I mean that in a class demonstration I can say to people "please be aware this isn't secure" ... of course I can say that online too, but there's a significant minority who don't read the caution, or don't believe it ...

Anyway ...

A new example of a pair of PHP scripts ... to index all the images in a directory (with thumbnails) [here], and the script to actually generate a thumbnail [here]. Simple and effective HTML generated in the first script, and image handling (a bit modernised) in the second.

A bit simpler than the previous image viewing application which navigate images in pages [here], and cleaner images that the previous thumbnailer [here].

New examples are much easier to follow ... old examples I can go through during a training course if need be. New examples look nicer too because I've switched from ImageCreate to ImageCreateTrueColor in my thumb nail graphic code.

New sample: (run it [here])


Old sample: (run it [here])