image
image copied to clipboard
Feature: allow resizing to smallest side.
It would be nice if we could also scale to the smallest side.
Currently, if the original size was 800x600 it will be changed to 400x300 using the code below.
However, if we want to make sure all images are at least 400x400 as this is requirements for some sites, we can't do that. If it were to do that, the sizing would be 500x400 by pinning the value to the smallest side.
This makes sure it always fits the minimum requirements of 400x400 in this example.
Currently, there is no way to achieve this.
// resize the image so that the largest side fits within the limit; the smaller
// side will be scaled to maintain the original aspect ratio
$img->resize(400, 400, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
});
What about heighten(), fit(), crop()?
Maybe the pad() method in version 3 this is what you are looking for.