Open musaffa opened 10 years ago
@musaffa Thanks for the input. Appreciate it.
Got a question for you. When you say "I use this gem to crop images even before being uploaded...", how exactly are you implementing it? How do you retrieve that image before uploading it for cropping. Also, are you considering versions of the image to be uploaded and cropped? My original intent of this gem is to crop the uploaded images which is why I have used before_update
.
Regarding the naming suggestion, I am going to stick with the current field names prefixed with crop_
because they are related to the image (dimensions) and not related to the dimensions of cropbox
.
As for the ActiveSupport::SafeBuffer
suggestion goes, I would like to merge it with the current code but for that you would need to revert back the hidden field naming change to the original naming and submit again.
ok i've removed cropbox suggestion.
To retrieve image before upload, you can use javascript's File Api. Just search 'javascript preview an image before it is uploaded' in google. There are tons of examples there. As soon as an image tag is created for a preview, an event handler should catch that change in dom and apply jcrop on it.
@musaffa Thanks a lot! Could you please rebase and squash these commits after reverting the callback change. I think once that is done this should be good to go! Also, regarding the part of cropping images even before they are uploaded, may be you could think of opening it as a new pull request and we will treat it as a new feature or something.
before_update
tobefore_save
which makes it more generic. Now it works before upload and update after upload.ActiveSupport::SafeBuffer
to loop through the crop fields.