filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.09k stars 2.83k forks source link

FileUpload imageEditor cannot restrict free cropping #9097

Closed NaungYeHtet closed 11 months ago

NaungYeHtet commented 11 months ago

Package

filament/forms

Package Version

v3.0.0

Laravel Version

v10.10

Livewire Version

No response

PHP Version

8.1

Problem description

Cannot crop based on Aspect Ratios.

FileUpload::make('image') ->image() ->imageEditor() ->imageEditorAspectRatios([ '1:1', ])

image

Expected behavior

User can only crop based on permitted aspect ratios.

Steps to reproduce

->imageEditorAspectRatios([ '1:1', ])

Reproduction repository

https://github.com/NaungYeHtet/filament-ascept-ratio

Relevant log output

No response

chosten commented 11 months ago

When there is only one aspect ratio, you can use imageEditorViewportHeight and imageEditorViewportWidth to force the aspect ratio. It's not very clear and I'm not sure those 2 methods do what their name suggest.