How to get image scaled down proportionally (given a constraint)
Started by landitus, Jan 12 2012 03:35 PM
images scale
5 replies to this topic
#1
Posted 12 January 2012 - 03:35 PM
Is it possible to get an image scaled down proportionally, like for example, I need it to fit in a 400px box (no height constraint). And the images might have different heights that would respond to the given constraint? Right now it seems I need to specify the width and height of the image that it placed, but the problem is I have images of different sizes and proportions.
#2
Posted 12 January 2012 - 04:06 PM
You can specify 0 for the width or height to have it be proportional to the other dimension. Or you can just use the width(x) or height(y) functions rather than size(x, y) function. So in your case, I think what you are asking for is this:
$image = $page->image->width(400);
#5
Posted 16 January 2012 - 10:11 AM
There might be better way to do it, but this should work:
if ($image->width > 32 || $image->height > 32) $img = $image->size(32,32); else $img = $image;
Also tagged with one or more of these keywords: images, scale
Community Support →
API & Templates →
Image tagsStarted by dragan, Today, 05:37 AM |
|
|
||
Community Support →
Getting Started →
max width + max height setting for images on upload (keeping aspect ratio)Started by fenton, 12 Jun 2013 |
|
|
||
Community Support →
General Support →
wrong image orientationStarted by Marco Angeli, 11 Jun 2013 |
|
|
||
Community Support →
General Support →
stuck with repeaterStarted by Marco Angeli, 11 Jun 2013 |
|
|
||
Community Support →
Getting Started →
Output images with limitStarted by k07n, 14 May 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













