Gallery Image: Display a single record item within a list viewer

4 posts by 2 authors in: Forums > CMS Builder
Last Post: December 28, 2008   (RSS)

Re: [virgodesign] Gallery Image: Display a single record item within a list viewer

By Dave - December 27, 2008

Hi Avrom,

Try replacing the foreach loop with something like this:

<?php foreach ($record['images'] as $upload): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>" alt="" />
<?php break; ?>
<?php endforeach ?>


Since it's a gallery we can drop the if isImage or if hasThumbnail since we know there will always be images and they'll always have thumbnails. Next, we use the thumbnail variables (eg: thumbUrlPath, etc) to show the thumbnail instead of the full size image. Finally, we add a break on the end to "break out of the loop" after just one pass.

Hope that helps, let me know if that does what you need.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Gallery Image: Display a single record item within a list viewer

By avrom - December 27, 2008

Perfecto !! Thanks :))

Re: [virgodesign] Gallery Image: Display a single record item within a list viewer

By avrom - December 28, 2008

Hi Dave,

I also found this solution in an earlier posting while looking for something else, I think it works well too:

http://www.interactivetools.com/forum/gforum.cgi?post=67071#67071

<?php $upload = $record['images'][0]; ?>
rest of code...

Cheers
Avrom