Giter VIP home page Giter VIP logo

rjcrop's People

Contributors

andion avatar jschwindt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rjcrop's Issues

dose this project suit for rails3?

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?

Image gets cached, so doesn't change after crop

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.