php-imagine / Imagine

PHP Object Oriented image manipulation library
https://imagine.readthedocs.io
Other
4.42k stars 529 forks source link

Feature request: scale images keeping aspect ratio #688

Closed julesbl closed 6 years ago

julesbl commented 6 years ago

Something that needs doing a lot is scaling images without changing their aspect ratio. So doing something like resizeFixedAspect(Box(200, 150)) and the supplied image gets resized to a maximum height or 150px or maximum width of 200px but keeps its aspect ratio.

...

What's the PHP version you are using?

output of php -v

What's the imaging library you are using [gd/imagick/gmagick/any]?

...

What's the imaging library configuration

For example, for imagick, output of php --ri imagick

Minimal PHP code to reproduce the error:


// Please write the PHP code that shows the issue
// Use only code of the Imagine library (no 3rd party PHP libraries)
// If you load an image, please provide it too so that we can replicate your issue
mlocati commented 6 years ago

This can already be done with the thumbnail method, using the THUMBNAIL_INSET flag