Skip to content
Browse files

Added conditional for default scaling of images.

(cherry picked from commit 6a0ff6f0f76a92a25c9cbbc315d3d7d11d1d7720)
  • Loading branch information...
1 parent 2826cdb commit 80d699ca144c773c239a436a8bd562b71a78f18f @mikeric mikeric committed with jyurek May 28, 2009
Showing with 14 additions and 1 deletion.
  1. +2 −1 lib/paperclip/thumbnail.rb
  2. +12 −0 test/thumbnail_test.rb
View
3 lib/paperclip/thumbnail.rb
@@ -63,7 +63,8 @@ def make
# into the thumbnail.
def transformation_command
scale, crop = @current_geometry.transformation_to(@target_geometry, crop?)
- trans = "-resize \"#{scale}\""
+ trans = ""
+ trans << " -resize \"#{scale}\"" unless scale.blank?
trans << " -crop \"#{crop}\" +repage" if crop
trans << " #{convert_options}" if convert_options?
trans
View
12 test/thumbnail_test.rb
@@ -178,6 +178,18 @@ class ThumbnailTest < Test::Unit::TestCase
end
end
end
+
+ context "being thumbnailed with a blank geometry string" do
+ setup do
+ @thumb = Paperclip::Thumbnail.new(@file,
+ :geometry => "",
+ :convert_options => "-gravity center -crop \"300x300+0-0\"")
+ end
+
+ should "not get resized by default" do
+ assert_no_match(/-resize/, @thumb.transformation_command)
+ end
+ end
end
context "A multipage PDF" do

0 comments on commit 80d699c

Please sign in to comment.
Something went wrong with that request. Please try again.