Jump to content

Image squeezing not cropping


onjegolders
 Share

Recommended Posts

Am running into a problem where it seems using the ->size() method, my images are squeezing to fit rather than cropping. I though images would crop so as to maintain their ratio?

Or perhaps it's too early on a Sunday morning to be looking at code ;)

Here is what I have:

<!-- Main image -->
<?php $main = $page->main_image->size(920,250); ?>
<img src="<?php echo $main->url; ?>" alt="<?php echo $page->title; ?>" width="<?php echo $main->width; ?>" height="<?php echo $main->height; ?>" class="small_frame" id="main_image" />

<!-- Thumbnails -->
<?php
if ($page->images !="") { ?>

<div id="thumbs">

<?php
$images = $page->images;
foreach ($images as $image) {
$class = "thumb small_frame";
$thumb = $image->size(160,60); ?>
<img src="<?php echo $image->url; ?>" alt="<?php echo $page->title; ?>" width="<?php echo $thumb->width; ?>" height="<?php echo $thumb->height; ?>" class="<?php echo $class; ?>" />
<?php }

?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...