deekepMaks's avatar

Uploading and cropping photos.

At the moment, I'm cropping the photo on the client using the croppie library, then sending it to the server and using Image to do the necessary cropping. In this case, if the user enters the settings again, then there will already be a cropped photo, and not the original one. Advise how to be in this case? I would like to have the original photo too, so that the user can change the cropping position in the settings, and not upload the photo again. Should I save the original photo and the cropped photo together, or can I save the original and digitally sign it (maybe something else) sign my comment with the coordinates, and then use these coordinates and crop the photo when issuing the photo to the client?

0 likes
5 replies
vincent15000's avatar

I don't know this croppie library```.

I use the spatie media library which is very convenient and fully integratable to Laravel.

deekepMaks's avatar

@vincent15000 croppie is just a jqeury library that selects a cropped area. With it, I just get the coordinates, and on the server I cut it using the Image. My main question is how to save pictures correctly.

1 like
deekepMaks's avatar

@vincent15000 Yes, that's what I do. But I crop the picture and when the user enters the settings again, he gets the cropped picture. I would like the original one to be there, but I want the cropped one to be displayed in profile. Do I need to save both the original and the cropped one?

1 like
vincent15000's avatar
Level 63

@deekepMaks You can effectively save both the original and the cropped pictures, it will be more easy to display really what you need.

If you want to store only the original picture and crop it to display it in the profile, I suggest you to use an external very efficient API.

https://imagekit.io/

Please or to participate in this conversation.