#22 √ resolved
Clemens Kofler

Paperclip functionality inconsistent /w ImageMagick options

Reported by Clemens Kofler | July 10th, 2008 @ 08:03 AM

Hi folks,

I've just tried to use Paperclip to resize an image to width = 120px - no matter if it's smaller or larger than that. According to the ImageMagick docs on geometry definition (http://www.imagemagick.net/scrip...) it should be possible to do this using the following specifications:

  • "120" (width only, up and down scaling)
  • "x120" (height only)

However, Paperclip sets the height to the value of width if no width is given and vice versa - which is kinda wicked, considering it's shown differently in the IM docs.

I'm not sure if I've spotted every place where little code changes are necessary but I think it's mostly in the geometry.rb:

  • initialize needs to be changed so that it keeps blank values blank.
  • parse needs a slightly modified Regexp. /\b(\d*)x(\d*)\b([\>\<\#\@\%^!])?/ should read /\b(\d*)x?(\d*)\b([\>\<\#\@\%^!])?/.
  • to_s needs modification so that it handles blank values correctly - they should be left blank instead of 0 and the modifier can only be applied if both parameters are present (as far as I understand the IM docs).
  • transformation_to should be refactored as I posted in this ticket: http://thoughtbot.lighthouseapp....

Since I'm note entirely sure whether you actually want this functionality to change, I haven't created a patch yet. If you want me to supply a patch, just tell me and I'm happy to do it.

  • Clemens

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket