Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for specifying a min and max aspect ratio #63

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from

Conversation

takdw
Copy link

@takdw takdw commented Feb 11, 2021

Add support for specifying min and max aspect ratio values for cropping

This PR tries to add a functionality that allows users to specify a minimum and maximum range for aspect ratio. This can be useful when you want to allow a varying number of crop aspect ratios. It uses a listener on a CropperJs instance to determine the crop box. I have still kept the existing vue-cropperjs implementation and that is preferred when the user wants a crop of a fixed aspect ratio. It also allows for cropping outside the bounds of the image. The empty space is filled a white (#ffffff) color.

Usage

AdvancedImage::make('Logo', 'logo')->croppable(1); // square crop 1:1
AdvancedImage::make('Logo', 'logo')->croppable(16 / 9); // 16:9 crop ratio
AdvancedImage::make('Logo', 'logo')->croppable(1, 2); // allowed crop ratios are from 1 (1:1) to 2 (2:1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant