Topic: Specify Width ,Height is auto

Hello,

Is it possible to specify a width and have the height be auto to prevent distortion?

Thanks!

Randy

2 (edited by mike 2011-06-06 18:27:21)

Re: Specify Width ,Height is auto

Do you mean when resizing an image?  If so the height and width specified  are maximums.  The image aspect ratio is always preserved.

So specifying a resize width and height of 320x240 doesn't mean all of the images will be made exactly 320x240 - but they will be resized such that one of the dimensions will be 320 or 240 (or it will be exactly 320x240 if your source image happens to have an aspect ratio of 320/240).

Re: Specify Width ,Height is auto

Oh and if you want every image resized to have the same width, but the height varies to match the aspect ratio of the source image you could try setting the resize width to your chosen width, and the resize height to a very large number (larger  than the height of any possible source image).

Re: Specify Width ,Height is auto

Mike,

Thank you, that's awesome!

Randy

Re: Specify Width ,Height is auto

Very useful info, thanks mate.

Re: Specify Width ,Height is auto

Is this how the image resizing works in version 1.3 in the Yii extension? Thanks

Re: Specify Width ,Height is auto

I'm pretty sure the basics of how a resized image's dimensions are determined has not changed in a very long time.  It sill works the same in 1.3.

But I don't know what a Yii extension is so I can't help you there?

Re: Specify Width ,Height is auto

They're saying the width and height should have an option to be minimums, yet keep the same aspect ratio. Like this image: http://www.omega-webdesign.nl/plupload-demo.jpg