Display Default Img if None Uploaded

2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 2, 2010   (RSS)

Re: [aquaman] Display Default Img if None Uploaded

By Damon - February 2, 2010

Hi,

Try this:

<?php foreach ($record['property_photos'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt="<?php echo $record['heading'] ?>" /></a>
<?php endif ?>
<?php break; ?>
<?php endforeach ?>

<?php if (!$record['property_photos']): ?>
<img src="library/img/default-investment.gif" width="150" height="100" alt="<?php echo $record['heading'] ?>" />
<?php endif ?>

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/