Gregwar / Image

A PHP library to handle images
MIT License
1k stars 190 forks source link

maxDimensionsResize #107

Closed garygreen closed 7 years ago

garygreen commented 8 years ago

Is there currently a way to only scale resize if either the width or height is larger than X?

This is useful if you want users to upload any size image but scale down on the server if too large.

something like:

$image->maxDimensionsResize([2048, 2048]); // Image is 1024, 800 and won't be touched.
$image->maxDimensionsResize([2048, 2048]); // Image is 3000, 800 and will scale down
soullivaneuh commented 8 years ago

I would say this belong more to code logic that the library itself.

if ($width > 2048) {
    resize(...)
}
garygreen commented 8 years ago

Maybe. But I think it's common enough to warrant being a proper resize method.

Maybe scaleDownResize()

soullivaneuh commented 8 years ago

@Gregwar What do you think?

Gregwar commented 7 years ago

Actually, cropResize() already does this since it will not downscale and crops the extra padding (Really late reply warning, don't know if it's usefull)