Path to display image

5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 4, 2010   (RSS)

By paulmac - May 4, 2010

Hi

I'm trying to build up a table that will display an image and a project description for that image. Displaying the project description is fine, but I can't work out how to display the path to the image. The code is:

<table width="100%" border="1" cellspacing="0" cellpadding="4">


<?php foreach ($client_testimonialsRecords as $record): ?>

<?php if ( $record['home_page'] == 1 ) {
echo "<tr>";
echo "<td>";
echo "<img src=\"$thumbUrlPath\" alt=\"image name\" />";
echo "<td>";
echo $record['project_description'];
echo "</td>";
echo "</td>";
echo "</tr>";
} ?>

<?php endforeach ?>
</table>

Appreciate any help.

Thanks

Re: [paulmac] Path to display image

By gkornbluth - May 4, 2010

Hi Paulmac,

If I understand you correctly, I think you need think you'll need a foreach loop around your image call as well to pull the images from your record.

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


Hope that works for you

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [paulmac] Path to display image

By paulmac - May 4, 2010

Hi Jerry

That makes sense all right, my only problem is my php skills aren't that strong. Could you advise on the correct syntax to get this working.

Thanks

Re: [paulmac] Path to display image

By paulmac - May 4, 2010

Worked perfectly, thanks for all the help. Really appreciate it.