Gregwar / Image

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

Add ability to specify custom cropping values for zoomCrop #151

Closed garygreen closed 3 years ago

garygreen commented 6 years ago

Currently, when you use zoomCrop() you cannot set custom cropping position other than basic left / right, top / bottom, center.

With this PR, you can set a target cropping "zone" as it were (based on the original dimensions of the image) and it will try to crop from that area. It also handles if the given cropping position will result in a crop outside the bounds by forcing it stay within the bounds of the image (maybe that could be configured, if people really want it to crop outside for some reason?)

My use case: I use a library to do face detection which returns a X, Y coords of the face. I want to zoomCrop around that area but currently that is not easily possible, this PR allows such a use case and others.

garygreen commented 5 years ago

@Gregwar any news on this?

garygreen commented 3 years ago

@Gregwar please can you respond? This is really needed in our app

Gregwar commented 3 years ago

Sorry for the huge delay Thanks for contributing

garygreen commented 3 years ago

Thank you! 😁

Gregwar commented 3 years ago

Will you need a new version tag?

garygreen commented 3 years ago

Yes please. This PR is fully backwards compatible, there's no breaking changes. So should only need a minor version bump