PHP Thumbnail Linking

Hi,

Just a quick overview - I am creating a basic gallery that displays images that are located in a folder.

The main thing I need help with is how to make it so when a user clicks on the thumbnail, it displays the larger image.

The thumbnail images are located in “images/gallery/flowers/thumbs” and the main larger images are located in “images/gallery/flowers”

The PHP code i have so far is -

<?php $dirname = "images/gallery/flowers/thumbs"; $images = scandir($dirname); $ignore = Array(".", "..", ".DS_Store"); foreach($images as $curimg){ if(!in_array($curimg, $ignore)) { echo "
\n"; }; } ?>

This code searches the folder and displays the thumbnails so I just need to know what code to put in there somewhere so the thumbnails can link to the larger images.

Any help would be appreciated as I’m new to this and thanks! :smiley:

assuming that the current code is working correctly and both the thumbnail and the full size image have the same filename, try wrapping it in an anchor tag.

[php]

<img src

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service