Commit b0e515ee by Adam Lassek

Fix GeometryParser regex for usage of '@>' flag

According to the ImageMagick documentation the '@' flag is a special case that
can be used in conjunction with '>' to prevent IM from scaling an image up.
The '<' flag is ignored when using '@'.

http://www.imagemagick.org/Usage/resize/#pixel

This fixes the issue I reported in #1851
parent c819d5da
module Paperclip
class GeometryParser
FORMAT = /\b(\d*)x?(\d*)\b(?:,(\d?))?([\>\<\#\@\%^!])?/i
FORMAT = /\b(\d*)x?(\d*)\b(?:,(\d?))?(\@\>|\>\@|[\>\<\#\@\%^!])?/i
def initialize(string)
@string = string
end
......
......@@ -82,7 +82,7 @@ describe Paperclip::Geometry do
assert_equal 456, @upper.height
end
['>', '<', '#', '@', '%', '^', '!', nil].each do |mod|
['>', '<', '#', '@', '@>', '>@', '%', '^', '!', nil].each do |mod|
it "ensures the modifier #{description} is preserved" do
assert @geo = Paperclip::Geometry.parse("123x456#{mod}")
assert_equal mod, @geo.modifier
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment