i’m fairly new to PHP and can’t seem to figure this one out.
i’ve normally been able to find what i need through google and through trial and error and then figure out why it does what it does but this one is stumping me.
currently i have my php script query a thumbnail folder on my server, this in turn auto populates the page with the thumbnails. when you click on the thumbnail the you are taken to a new blank white page with the image in the top left.
my question is this, is there a way to place a target=_parent action into my script to have the larger image either open in the same page or in a new fit to size window making it easier for my eventual viewers to navigate the images.
the following is my script that i am currently using.
<?php
$images = glob('*.{jpg,jpeg,png,gif}', GLOB_BRACE);
foreach ($images as $image) {
if (file_exists("./thumbs/{$image}")){
echo "<a href=\"{$image}\"><img src=\"thumbs/{$image}\" alt=\"{$image}\" /></a>";
}else{
echo "<a href=\"{$image}\"><img src=\"?img/{$image}\" alt=\"{$image}\" /></a>";
}
}
?>
any help or insight would be greatly appreciated.
i dont think you need a php script to do it. after loading the thumbnails you can use javascript to open a lightbox to view the images.
http://lokeshdhakar.com/projects/lightbox2/
check this, it is a free lightbox plugin.