scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 304 forks source link

Load the image with cropped offset #112

Closed akfaisel closed 8 years ago

akfaisel commented 8 years ago

Hi,

After cropping, I'm uploading the original and cropped image to the server.

While retrieving, I am using imageState to retrieve the original image so that users can move the image and save it again.

The only issue is, I'm not able to initially show the users the already cropped image.

Please advise.

scottcheng commented 8 years ago

You would need to also keep track of the "cropping configurations", namely zoom and offset. You could get them with $editor.cropit('zoom') and $editor.cropit('offset') respectively. When rendering the cropped image again, pass in zoom and offset together with the image source in imageState.

akfaisel commented 8 years ago

Thanks for your reply.

So you mean to say, I must save these values in the database and retrieve it back?

scottcheng commented 8 years ago

That's correct. If you want the user to continue editing the image you have to save the state. Otherwise you can let them start over.