Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDave Faliskie
17,793 PointsHow to crop an image with rails 4
I have used paperclip to allow a user to upload a picture. I want to allow the user to choose the area of the picture they want to be used in a square cropped version. Everything online points to the rails cast #182. However I couldn't get it to work. Is it because it is outdated? is there a better way to allow cropping of an image?
1 Answer
Maciej Czuchnowski
36,441 PointsYou could try this: https://github.com/rsantamaria/papercrop
I'm curious and will probably try using it myself as well.
Dave Faliskie
17,793 PointsDave Faliskie
17,793 PointsYes I tried that and it seems to work. I can see the image select an area, and view a preview. The problem is I click save nothing happens. I'm almost positive it is the way I have my controller written, I'll post below what I have.
any Ideas on how to properly write the controller. The "crop" file is exactly as shown on the papercrop docs.
Thanks, Dave
Maciej Czuchnowski
36,441 PointsMaciej Czuchnowski
36,441 PointsUnfortunately I did not manage to implement this myself properly. It shows up, but doesn't save the newly cropped file. And the documentation is very scarce.
Dave Faliskie
17,793 PointsDave Faliskie
17,793 PointsExactly my problem. Do you know how to make it work, or is there a better way to add this feature. Or is this a feature I should just forget about?
Maciej Czuchnowski
36,441 PointsMaciej Czuchnowski
36,441 PointsI don't have any solution for you at this moment. I may find it in the future and I will post it here if I do.