vendor/plugins/paperclip/lib/paperclip/geometry.rb in spree-0.8.5 vs vendor/plugins/paperclip/lib/paperclip/geometry.rb in spree-0.9.0

- old
+ new

@@ -14,21 +14,21 @@ # Uses ImageMagick to determing the dimensions of a file, passed in as either a # File or path. def self.from_file file file = file.path if file.respond_to? "path" geometry = begin - Paperclip.run("identify", %Q[-format "%wx%h" "#{file}"]) + Paperclip.run("identify", %Q[-format "%wx%h" "#{file}"[0]]) rescue PaperclipCommandLineError "" end parse(geometry) || raise(NotIdentifiedByImageMagickError.new("#{file} is not recognized by the 'identify' command.")) end # Parses a "WxH" formatted string, where W is the width and H is the height. def self.parse string - if match = (string && string.match(/\b(\d*)x?(\d*)\b([\>\<\#\@\%^!])?/)) + if match = (string && string.match(/\b(\d*)x?(\d*)\b([\>\<\#\@\%^!])?/i)) Geometry.new(*match[1,3]) end end # True if the dimensions represent a square @@ -63,10 +63,11 @@ # Returns the width and height in a format suitable to be passed to Geometry.parse def to_s s = "" s << width.to_i.to_s if width > 0 - s << "x#{height.to_i}#{modifier}" if height > 0 + s << "x#{height.to_i}" if height > 0 + s << modifier.to_s s end # Same as to_s def inspect