Show one image only from a list of image uploads
2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 26, 2011 (RSS)
I have a single page which has thumbnail uploads, I have javascript on them to make them fade as a rollover so that is why I couldn't have it as a list page, each image links to another page which has the same layout, how can I tell that second page to pull in a certain image from the list of uploads, It's as if each image in the uploads needs to have a number and you tell that page to bring in that number.
Re: [Mercer Design] Show one image only from a list of image uploads
By Jason - January 26, 2011
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:
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:
Hope this helps
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/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/