Change the default value of the image crop format

Hi, is it possible to change the default value of the image crop format in the editor? Thank you.
No description
Solution:
Hello, I found out why FREE is not activated at startup. It is due to the presence of values ​​in imageResizeTarget. If there are values ​​there, it starts keeping these measurements. So, in fact, it is not a BUG, ​​but rather expected behavior. Once again, I thank you for your help and your time.
Jump to solution
15 Replies
joao nivaldo
joao nivaldoOP2w ago
Thanks for the answer, but I've already read this page and I can't find how to change the default value. Whenever I click on the editor icon it displays the crop rectangle in a fixed format. I wanted it to be free so the user can crop without maintaining the aspect ratio. Just like you do when you click on FREE crop.
awcodes
awcodes2w ago
Isn’t the default behavior free form though.? The aspect ratio it just a quick action to set the constraints. Does ‘livre’ not reset it to free form?
joao nivaldo
joao nivaldoOP2w ago
When it starts, it comes with a pattern in which it calculates proportion. If I move it vertically, it changes the width.
awcodes
awcodes2w ago
Weird. Looks like it’s defaulting to 16:9
joao nivaldo
joao nivaldoOP2w ago
So I wanted to change this to free form when you enter the screen. Here everything is updated and it looks like this. Is there a way?
awcodes
awcodes2w ago
I’m sure there is, but I don’t understand why it’s not defaulting to free form.
joao nivaldo
joao nivaldoOP2w ago
I may have done something wrong when calling the component. I'll post my code and if you find something wrong just tell me and I'll change it. Thanks
php
FileUpload::make('site_header')
->hiddenLabel()
->disk('public')
->directory('site_images/' . now()->format('Y/m'))
->acceptedFileTypes(['image/png'])
->imageEditor()
->imageResizeMode('cover')
->imageResizeTargetWidth('400')
->imageResizeTargetHeight('200')
->panelAspectRatio('16:9') //formato do box de preview
->imageEditorAspectRatios([null, '1:1', '16:9',])
->maxSize(1024),
php
FileUpload::make('site_header')
->hiddenLabel()
->disk('public')
->directory('site_images/' . now()->format('Y/m'))
->acceptedFileTypes(['image/png'])
->imageEditor()
->imageResizeMode('cover')
->imageResizeTargetWidth('400')
->imageResizeTargetHeight('200')
->panelAspectRatio('16:9') //formato do box de preview
->imageEditorAspectRatios([null, '1:1', '16:9',])
->maxSize(1024),
awcodes
awcodes2w ago
Hmm. Looks ok to me. My best guess is that it’s falling back to panelAspextRatio() since the default editorAspectRatio is null. On my phone at the moment so can’t really source dive. Could be a possible bug though.
joao nivaldo
joao nivaldoOP2w ago
I've tried without panelAspectRatio() and it was the same. For this reason I had to put >imageEditorAspectRatios([null, '1:1', '16:9',]), so the client could choose Free. If you could do a test as soon as possible and see if it's a bug or if it's something here with me, I'd really appreciate it.
awcodes
awcodes2w ago
I don’t have anything setup with the image editor to even test. Sorry. I wrote the curator plugin because that’s what I use. If you have a reproduction repo you can share I can investigate further, “as soon as possible”
joao nivaldo
joao nivaldoOP2w ago
I will create a repository and simulate it. Then I will reply here with the repository link. Thank you very much.
awcodes
awcodes2w ago
Sounds good. It’s just really difficult for us to determine if it’s a bug or not in your app without a reproduction repo. Thank you.
joao nivaldo
joao nivaldoOP2w ago
I understand. I will simulate it here and get back to you. Thanks.
Solution
joao nivaldo
joao nivaldo7d ago
Hello, I found out why FREE is not activated at startup. It is due to the presence of values ​​in imageResizeTarget. If there are values ​​there, it starts keeping these measurements. So, in fact, it is not a BUG, ​​but rather expected behavior. Once again, I thank you for your help and your time.
Want results from more Discord servers?
Add your server