IF image THEN ...

13 posts by 2 authors in: Forums > CMS Builder
Last Post: May 6, 2008   (RSS)

By Dave - May 2, 2008

Great, glad to hear it's working! For the other it's the same idea:

<td id="sumimg-mainimage">

<?php $mainImages = getUploads($options['tableName'], 'main_image', $record['num']) as $upload); ?>

<?php foreach ($mainImages as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $upload['urlPath'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>"
alt="Product Main Image - <?php echo $upload['filename'] ?>" title="<?php echo $record['name'] ?>" /></a>
<?php endif ?>
<?php endforeach ?>

<?php if (count($mainImages) == 0): ?>
<img src="/images/NoImage-main.jpg" alt="NoImage-main.jpg" />
<?php endif ?>

</td>


Let me know if that does it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] IF image THEN ...

By rasbro - May 6, 2008

Dave, once I discovered this error in the code you gave me...

<?php $mainImages = getUploads($options['tableName'], 'main_image', $record['num']) as $upload); ?>

and changed it to...

<?php $mainImages = getUploads($options['tableName'], 'main_image', $record['num']); ?>

then it worked great.

Thanks!