RMagick and Image Manipulation

If the image is really large, performing RMagick operations on it could take time. I was under the impression that this was blocking, but maybe I’m wrong, but anyways, try moving your thumbnail manipulations before the original image:

thumb = (RAILS_ROOT + "/public/client_images/#

{client}/" +
image = Magick::ImageList.new(thumb)

  image   = image.rotate(-90)


image = Magick::ImageList.new(“public/client_images/#

  • photo.filename)
    image = image.rotate(-90)
    image.write(“public/client_images/#{client}/” + photo.filename)

Also, an implementation consideration: you could consider queueing up the effects applied (in a session variable array, [‘rotate:90’, ‘scale:2’] etc. perhaps) and only applying the effects to the original image when the user hits “save”. Do the operations only on the thumb meanwhile since only that’s getting displayed.

If the thumb is small, Firefox supports data urls, data:

You can pass this inline in the index file, tho this is definitely clunky.