rsantamaria / papercrop

An easy extension for Paperclip to crop your image uploads using jCrop.
203 stars 83 forks source link

Can't pass Paperclip Thumb into Papercrop #48

Open igolden opened 8 years ago

igolden commented 8 years ago

Hey there, thanks for the awesome plugin!

Right now I'm using the plugin in my app to crop profile pictures. The issue is that some people upload really large photos, which makes Papercrop break (zoom issue, offcenter crop issue).

So my solution has been to process the images down to >1000px wide in Paperclip, and then I'd like to pass Papercrop that version of the image. But when I pass Papercrop @card.photo.url(:croppable), I get an undefined method error. I've tried a few other syntax ideas too, no luck.

How can I pass a processed version of my image to papercrop?

Thanks again for all your work on this gem my friend!

igolden commented 8 years ago

I just found a temporary solution, but I think this could be a great feature in the future.

For now, I process the "original" style, which gets passed to papercrop.

has_attached_file :photo, :styles => { original: "1000x1000>", medium: "300x300>" }, default_url: "/images/:style/missing.png"

igolden commented 8 years ago

It'd be great to do something like the following

<%= f.cropbox @user.photo(:croppable) %>