John Lessing
Require cropping to a certain size before submitting
Hello there,
I'm struggling with a similar use case, so I hope, posting to this thread is the right call:
I'd like to force the user to crop the image for e.g. a profile picture to a 1:1 aspect ratio.
So far I tried two options:
Hereby the user must actively click on the edit button to access the editor and the 1:1 aspect ratio isn't enforced. It just adds buttons for setting the crop tool to specific aspect ratios. In my case with only one ratio given, there isn't even a button present.
I tried this code instead:
This automatically crops the image to a square in the middle of the source file with no chance for the user to specify the correct location in case the face is offset in the source file.
I'm sorry, if I'm missing something completely obvious, but I'm new to PHP 8 and Laravel. I hope, one of you can nudge me in the right direction.
8 replies