jschwindt / rjcrop Goto Github PK
View Code? Open in Web Editor NEWSample Rails app for image cropping using Paperclip and Jcrop
Home Page: http://schwindt.org/
Sample Rails app for image cropping using Paperclip and Jcrop
Home Page: http://schwindt.org/
i have look at the railscast about crop image ,i follow the code but it seems something didn't work in my computer ,so i find in here to ask ,is this demo support rails3?
In production I ran into an issue where the user would see the before image after they had cropped because cropping didn't update Rails' asset id and so the browser thought it was the same image. Rather than eliminating caching for that directory in Apache or trying to tap into ActionView and sweep the asset id cache, I thought it might be better to let paperclip change the filename based on the crop settings.
In Jcropper:
self.interpolates(:crop_suffix) do |attachment, style| target = attachment.instance if target && (style != :original) && target.cropping? "-#{target.crop_x.to_i}#{target.crop_y.to_i}#{target.crop_h.to_i}#{target.crop_w.to_i}" else "" end end
And in your model, add on these parameters:
:url => "/system/:attachment/:id/:style/:basename:crop_suffix.:extension", :path => ":rails_root/public/system/:attachment/:id/:style/:basename:crop_suffix.:extension"
At least that worked for me with Paperclip 2.4.5 and Rails 3. Sharing it here in case others run into the same problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.