Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Added conditional for default scaling of images.
Browse files Browse the repository at this point in the history
(cherry picked from commit 6a0ff6f0f76a92a25c9cbbc315d3d7d11d1d7720)
  • Loading branch information
mikeric authored and Jon Yurek committed Jul 9, 2009
1 parent 2826cdb commit 80d699c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/paperclip/thumbnail.rb
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions test/thumbnail_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 80d699c

Please sign in to comment.