I’m using the Paperclip gem with a Rails 3.1.1 app. It’s working as advertised and expected. I would like to use the imagemagick -liquid-rescale delegate, however. According to the imagemagick documentation (which I tried in terminal.app), this works:
convert logo_trimmed.jpg -liquid-rescale 75x100%\! logo_lqr.jpg
I tried a variation…
convert my_pic.jpg -liquid-rescale 60x60\! my_new_pic.jpg
That worked as expected, too. I’ve tried several permutations in my Image model in my rails app, but I cannot get Paperclip to invoke liquid-rescale. My latest attempt was:
has_attached_file :pic, :styles => {:square => "-liquid-rescale 60x60\!" }
This fails without an error message, merely duplicating the original image with a new name.
How do I instruct paperclip to invoke liquid-rescale?
Here’s what I did. I had to write a custom processor, which I named
liquid.In the model:I’m not sure whether the
:geometryoption is necessary, but I added it becausethumbnail.rbin the paperclip gem says that it’s not optional.I then added a file:
/my_app/lib/paperclip_processors/liquid.rbwith contents:Finally, I ran the following in the console:
That did the trick.