I've published a script which uses Image::Magick, File::Find, and Spreadsheet::WriteExcel to convert a list of directories containing images into spreadsheets of thumbnails with dirified filenames, including a link to a larger thumbnail.
It is of course a bit different from what you need, but some of the code may be useful.