Home > computer > Rails attachment_fu/Kropper Scaling Fix: attachment_fu_skip_resize

Rails attachment_fu/Kropper Scaling Fix: attachment_fu_skip_resize

October 1st, 2007

I recently integrated Kropper into a custom RoR application for OpenRain affiliate img surf. A fundamental flaw in the upload-save-crop-save process used by Kropper is that attachment_fu automatically scales down the image on first save to :resize_to dimensions. After the subsequent crop–which may result in a significant drop in resolution–the image is scaled back up to :resize_to dimensions: an ugly lossy operation.

The attachment_fu_skip_resize plugin gives attachment_fu the ability to temporarily bypass resizing of the full-size original image, thus allowing your final cropped photos to be of the highest quality as possible.

  1. Install the plugin.
  2. In your attachment_fu image class, add..
    attr_accessor :skip_resize
  3. Any time you want to save an image without invoking resizing on the original image..
    image.skip_resize = true
    image.save

    Thumbnails will be generated at their defined resolutions regardless of the skip_resize flag.

  • Share/Save/Bookmark

preston.lee computer , , , , , , ,

  1. July 2nd, 2008 at 13:39 | #1

    Hey. The Kropper is very KOOL…and I was hoping to give your plugin a try but the svn link is dead. Could you please update the link? Thanks in advance.

  2. July 2nd, 2008 at 13:44 | #2

    Ahh… We moved the repository a couple months ago. The new repository is..

    http://code.openrain.com/rails/

    The plugin hasn’t been updated in a while though.. please let us know if the current version works against the latest attachment_fu code. It’s a monkeypatch-based solution, so there is always the risk of breakage as attachment_fu evolves.

  3. Christopher Erdal
    August 19th, 2008 at 01:25 | #3

    I’m starting out on Rails, using Rails 2, after 25 years of database/c/delphi programming.

    Kropper, with your scaling fix (thanks!) would be ideal for my first real website (for an artist friend), but I can’t work out how to adapt Kropper-for-Rails-1 to work with Rails 2.

    Can anyone help with a few pointers?

    Thanks

  4. August 20th, 2008 at 14:41 | #4

    I haven’t used Kropper since moving to Rails 2, sorry :(

  1. October 2nd, 2007 at 23:06 | #1
  2. October 3rd, 2007 at 14:32 | #2
  3. October 17th, 2007 at 18:16 | #3
  4. March 31st, 2008 at 08:10 | #4