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
06f9b99e
Commit
06f9b99e
authored
Jan 08, 2009
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#47: Multipage PDFs fixed by Pete Deffendol
parent
8a43c13e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletions
+34
-1
lib/paperclip/geometry.rb
+1
-1
test/fixtures/twopage.pdf
+0
-0
test/thumbnail_test.rb
+33
-0
No files found.
lib/paperclip/geometry.rb
View file @
06f9b99e
...
...
@@ -16,7 +16,7 @@ module Paperclip
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
...
...
test/fixtures/twopage.pdf
0 → 100644
View file @
06f9b99e
File added
test/thumbnail_test.rb
View file @
06f9b99e
...
...
@@ -141,4 +141,37 @@ class ThumbnailTest < Test::Unit::TestCase
end
end
end
context
"A multipage PDF"
do
setup
do
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"twopage.pdf"
),
'rb'
)
end
teardown
{
@file
.
close
}
should
"start with two pages with dimensions 612x792"
do
cmd
=
%Q[identify -format "%wx%h" "
#{
@file
.
path
}
"]
assert_equal
"612x792"
*
2
,
`
#{
cmd
}
`
.
chomp
end
context
"being thumbnailed at 100x100 with cropping"
do
setup
do
@thumb
=
Paperclip
::
Thumbnail
.
new
(
@file
,
:geometry
=>
"100x100#"
,
:format
=>
:png
)
end
should
"report its correct current and target geometries"
do
assert_equal
"100x100#"
,
@thumb
.
target_geometry
.
to_s
assert_equal
"612x792"
,
@thumb
.
current_geometry
.
to_s
end
should
"report its correct format"
do
assert_equal
:png
,
@thumb
.
format
end
should
"create the thumbnail when sent #make"
do
dst
=
@thumb
.
make
assert_match
/100x100/
,
`identify "
#{
dst
.
path
}
"`
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