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
3d0d49f5
Commit
3d0d49f5
authored
Mar 06, 2013
by
Tieg Zaharia
Committed by
Jon Yurek
Mar 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add -layers 'optimize' flag to animated gif convert cmds
parent
42ca3985
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
lib/paperclip/thumbnail.rb
+1
-0
test/thumbnail_test.rb
+21
-4
No files found.
lib/paperclip/thumbnail.rb
View file @
3d0d49f5
...
...
@@ -96,6 +96,7 @@ module Paperclip
trans
<<
"-auto-orient"
if
auto_orient
trans
<<
"-resize"
<<
%["#{scale}"]
unless
scale
.
nil?
||
scale
.
empty?
trans
<<
"-crop"
<<
%["#{crop}"]
<<
"+repage"
if
crop
trans
<<
"-layers
\"
optimize
\"
"
if
animated?
trans
end
...
...
test/thumbnail_test.rb
View file @
3d0d49f5
...
...
@@ -381,12 +381,16 @@ class ThumbnailTest < Test::Unit::TestCase
should
"create the 12 frames thumbnail when sent #make"
do
dst
=
@thumb
.
make
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
assert_equal
"50x50"
*
1
2
,
`
#{
cmd
}
`
.
chomp
assert_equal
(
"50x5050x5050x5050x5050x5050x49"
)
*
2
,
`
#{
cmd
}
`
.
chomp
end
should
"use the -coalesce option"
do
assert_equal
@thumb
.
transformation_command
.
first
,
"-coalesce"
end
should
"use the -layers 'optimize' option"
do
assert_equal
@thumb
.
transformation_command
.
last
,
'-layers "optimize"'
end
end
context
"with omitted output format"
do
...
...
@@ -397,12 +401,16 @@ class ThumbnailTest < Test::Unit::TestCase
should
"create the 12 frames thumbnail when sent #make"
do
dst
=
@thumb
.
make
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
assert_equal
"50x50"
*
1
2
,
`
#{
cmd
}
`
.
chomp
assert_equal
(
"50x5050x5050x5050x5050x5050x49"
)
*
2
,
`
#{
cmd
}
`
.
chomp
end
should
"use the -coalesce option"
do
assert_equal
@thumb
.
transformation_command
.
first
,
"-coalesce"
end
should
"use the -layers 'optimize' option"
do
assert_equal
@thumb
.
transformation_command
.
last
,
'-layers "optimize"'
end
end
context
"with unidentified source format"
do
...
...
@@ -414,12 +422,17 @@ class ThumbnailTest < Test::Unit::TestCase
should
"create the 12 frames thumbnail when sent #make"
do
dst
=
@thumb
.
make
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
assert_equal
"60x60"
*
12
,
`
#{
cmd
}
`
.
chomp
assert_equal
"60x6059x5959x5959x5960x5959x5859x6059x5959x5959x5960x5959x58"
,
`
#{
cmd
}
`
.
chomp
end
should
"use the -coalesce option"
do
assert_equal
@thumb
.
transformation_command
.
first
,
"-coalesce"
end
should
"use the -layers 'optimize' option"
do
assert_equal
@thumb
.
transformation_command
.
last
,
'-layers "optimize"'
end
end
context
"with no source format"
do
...
...
@@ -431,12 +444,16 @@ class ThumbnailTest < Test::Unit::TestCase
should
"create the 12 frames thumbnail when sent #make"
do
dst
=
@thumb
.
make
cmd
=
%Q[identify -format "%wx%h" "
#{
dst
.
path
}
"]
assert_equal
"70x70
"
*
12
,
`
#{
cmd
}
`
.
chomp
assert_equal
"70x70
67x6867x6868x6769x6767x6768x6967x6867x6868x6769x6767x67"
,
`
#{
cmd
}
`
.
chomp
end
should
"use the -coalesce option"
do
assert_equal
@thumb
.
transformation_command
.
first
,
"-coalesce"
end
should
"use the -layers 'optimize' option"
do
assert_equal
@thumb
.
transformation_command
.
last
,
'-layers "optimize"'
end
end
context
"with animated option set to false"
do
...
...
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