If statment for image upload width

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

By Mikey - February 1, 2012

Can some tell me if it's possible to check the height of an uploaded image and if it exceeds a specific height (160px), then the image is skipped and the next uploaded image is displayed that falls within the allowed height?

My "Create thumbnail : " is set to:
Width: 240px
Height: 240px

My Div, (<div class="PhotoContainer">) I'm loaded the images into is set to:

So if I upload an image that is 6x4" it would re-size to 240px wide by 160px height and this image would display.
However if I uploaded a vertical image that is 4x6" it would re-size to 160px wide by 240px height and since it exceeds the allowed height of (160px) it is skipped and the next image that meets the height limitation is allowed to be displayed.

<?php foreach ($photoRecord['photos'] as $upload): ?>
<div class="PhotoContainer">
<?php if ($upload['hasThumbnail']): ?>

<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" class="Photo" />

<?php endif ?>
<?php endforeach ?>

Re: [aev] If statment for image upload width

By Mikey - February 2, 2012

Thanks aev

It works like a charm.
I really appreciate the help!


Re: [zick] If statment for image upload width

By aev - February 2, 2012


Maybe this could be of interest as well:

Remember to adjust the array names ($selectedRecord/$categoryRecords) to reflect your array names.