robsontenorio / mary

Laravel Blade UI Components for Livewire 3
https://mary-ui.com
Other
1.05k stars 131 forks source link

[Question] How to force cropping before accepting image? #714

Open styper opened 5 hours ago

styper commented 5 hours ago

maryUI version

1.41

daisyUI version

0

Livewire version

3.5

What browsers are affected?

Chrome

What happened?

I'm using the single file upload with preview and cropping, is there a way to only accept the image after it has been cropped?

Scenario is: I'm building a blog like page and the user has the option to upload a cover image.
In the cropper config I'm using 'aspectRatio' => 16/9 since that's the aspect ratio of the cover div.
Problem is, when I select an image it's already displayed in the preview, if I click "cancel" on the crop modal then the image persists in the preview without cropping.

robsontenorio commented 2 hours ago

Actually it would be a new feature force-crop, and to be honest there are multiples conflicting scenarios to deal with.

styper commented 1 hour ago

Understood. I thought maybe there was already a native way since I just started using Mary (great job btw). I may just add an event listener when the modal closes that trashes the image. Thank you for the response!