Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
67b37901
Commit
67b37901
authored
Jul 08, 2011
by
Tony Miller
Committed by
Prem Sichanugrist
Jul 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When generating thumbnails for animated images, pass the -coalesce
option to convert.
parent
ebb13066
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
lib/paperclip/thumbnail.rb
+1
-0
test/thumbnail_test.rb
+8
-0
No files found.
lib/paperclip/thumbnail.rb
View file @
67b37901
...
@@ -76,6 +76,7 @@ module Paperclip
...
@@ -76,6 +76,7 @@ module Paperclip
def
transformation_command
def
transformation_command
scale
,
crop
=
@current_geometry
.
transformation_to
(
@target_geometry
,
crop?
)
scale
,
crop
=
@current_geometry
.
transformation_to
(
@target_geometry
,
crop?
)
trans
=
[]
trans
=
[]
trans
<<
"-coalesce"
if
animated?
trans
<<
"-resize"
<<
%["#{scale}"]
unless
scale
.
nil?
||
scale
.
empty?
trans
<<
"-resize"
<<
%["#{scale}"]
unless
scale
.
nil?
||
scale
.
empty?
trans
<<
"-crop"
<<
%["#{crop}"]
<<
"+repage"
if
crop
trans
<<
"-crop"
<<
%["#{crop}"]
<<
"+repage"
if
crop
trans
trans
...
...
test/thumbnail_test.rb
View file @
67b37901
...
@@ -289,6 +289,10 @@ class ThumbnailTest < Test::Unit::TestCase
...
@@ -289,6 +289,10 @@ class ThumbnailTest < Test::Unit::TestCase
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
assert_equal
"50x50"
*
12
,
`
#{
cmd
}
`
.
chomp
assert_equal
"50x50"
*
12
,
`
#{
cmd
}
`
.
chomp
end
end
should
"use the -coalesce option"
do
assert_equal
@thumb
.
transformation_command
.
first
,
"-coalesce"
end
end
end
context
"with omitted output format"
do
context
"with omitted output format"
do
...
@@ -301,6 +305,10 @@ class ThumbnailTest < Test::Unit::TestCase
...
@@ -301,6 +305,10 @@ class ThumbnailTest < Test::Unit::TestCase
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
assert_equal
"50x50"
*
12
,
`
#{
cmd
}
`
.
chomp
assert_equal
"50x50"
*
12
,
`
#{
cmd
}
`
.
chomp
end
end
should
"use the -coalesce option"
do
assert_equal
@thumb
.
transformation_command
.
first
,
"-coalesce"
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment