only one image
2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 19, 2011 (RSS)
By Maurice - January 19, 2011
hi all,
i uploaded a few images but only want to display the first thumbnail and not all images.
what is the code for that or is there a manual??
Greetz
i uploaded a few images but only want to display the first thumbnail and not all images.
what is the code for that or is there a manual??
Greetz
-------------------------------------------
Dropmonkey.nl
Dropmonkey.nl
Re: [Maurice] only one image
By Jason - January 19, 2011
Hi Maurice,
You can use a normal foreach loop that you break out of after displaying the first image with a thumbnail.
For example:
This code will loop through the uploads for that record until it finds and image with a thumbnail. After it outputs the thumbnail, it breaks out of the loop.
Hope this helps
You can use a normal foreach loop that you break out of after displaying the first image with a thumbnail.
For example:
<?php foreach($record['images'] as $upload): ?>
<?php if($upload['hasThumbnail']):?>
<?php break; ?>
<?php endif ?>
<?php endforeach ?>
This code will loop through the uploads for that record until it finds and image with a thumbnail. After it outputs the thumbnail, it breaks out of the loop.
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/