[thelist] Pop up images

Ian Anderson ian at zstudio.co.uk
Mon Mar 27 04:52:43 CST 2006


Justin Zachan wrote:

> Since there are 100s of images, I was after a simple php method of having
> just one php page for the larger images i.e. large_image.php and this page
> would be populated with the correct image based on which thumbnail was
> selected.

One thing I think is important in these situations is having a 
consistent and meaningful naming convention for your images.

For instance, all large images can be called whatever.jpg and all thumbs 
can be called whatever_thumb.jpg.

In the database, don't store the actual filenames of the images, just 
the base name (e.g. "whatever"). Then, when you're iterating through the 
thumbnails, your code for each one looks like:

<a href="large_image.php?id=<?php echo($imgID) ?>">
   <img src="<?php echo($imgName) ?>_thumb.jpg">
</a>

This sort of thing is good when you're using server side tools to 
automate the thumbnail generation.

Does this help? Maybe you can offer a more specific question or guidance 
on which bits you're uncertain of?

Cheers

Ian


-- 
_________________________________________________
zStudio - Web development and accessibility
http://zStudio.co.uk

Snippetz.net - Online code library
File, manage and re-use your code snippets & links
http://snippetz.net




More information about the thelist mailing list