Re: [Mercer Design] Show one image only from a list of image uploads
Hi,
Each image has a unique num. So when you're outputting your list of images, you can make each one a link like this
EXAMPLE:
<?php foreach($record['images'] as $image):?>
<a href="detailPage.php?imgNum=<?php echo $image['num'];?>">
<img src="<?php echo $image['thumbUrlPath'];?>" width="<?php echo $image['thumbWidth'];?>" height="<?php echo $image['thumbHeight'];?>" />
</a>
<?php endforeach ?>
So in this we're passing the number of the image to the detailPage in a variable called imgNum.
On the detail page, when looping through our images, we can make sure we're only outputting that single image.
EXAMPLE:
<?php foreach $record['images'] as $image):?>
<?php if($image['num']!=@$_REQUEST['imgNum']){ continue;} ?>
<img src="<?php echo $image['urlPath'];?>" height="<?php echo $image['height'];?>" width="<?php echo $image['width'];?>" />
<?php endforeach ?>
Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/