
zick
User
Feb 1, 2012, 8:27 PM
Post #1 of 4
(244 views)
Shortcut
|
|
If statment for image upload width
|
Can't Post
|
|
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? Example: My "Create thumbnail : " is set to: Width: 240px Height: 240px My Div, (<div class="PhotoContainer">) I'm loaded the images into is set to: width:196px; height:160px; 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 ?> </div> <?php endforeach ?>
|