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
0d3027e7
Commit
0d3027e7
authored
May 09, 2014
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1514 from pbyrne/configure-disable-exif-orientation
Optionally disable inspecting EXIF for orientation
parents
be04cf02
0632282c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
lib/paperclip.rb
+4
-1
lib/paperclip/geometry_detector_factory.rb
+3
-1
spec/paperclip/geometry_detector_spec.rb
+15
-0
No files found.
lib/paperclip.rb
View file @
0d3027e7
...
...
@@ -75,6 +75,8 @@ module Paperclip
# * command_path: Defines the path at which to find the command line
# programs if they are not visible to Rails the system's search path. Defaults to
# nil, which uses the first executable found in the user's search path.
# * use_exif_orientation: Whether to inspect EXIF data to determine an
# image's orientation. Defaults to true.
def
self
.
options
@options
||=
{
:whiny
=>
true
,
...
...
@@ -83,7 +85,8 @@ module Paperclip
:log
=>
true
,
:log_command
=>
true
,
:swallow_stderr
=>
true
,
:content_type_mappings
=>
{}
:content_type_mappings
=>
{},
:use_exif_orientation
=>
true
}
end
...
...
lib/paperclip/geometry_detector_factory.rb
View file @
0d3027e7
...
...
@@ -14,9 +14,11 @@ module Paperclip
def
geometry_string
begin
orientation
=
Paperclip
.
options
[
:use_exif_orientation
]
?
"%[exif:orientation]"
:
"1"
Paperclip
.
run
(
"identify"
,
"-format '%wx%h,
%[exif:orientation]
' :file"
,
{
"-format '%wx%h,
#{
orientation
}
' :file"
,
{
:file
=>
"
#{
path
}
[0]"
},
{
:swallow_stderr
=>
true
...
...
spec/paperclip/geometry_detector_spec.rb
View file @
0d3027e7
...
...
@@ -20,5 +20,20 @@ describe Paperclip::GeometryDetector do
expect
(
output
).
to
eq
:correct
end
it
'avoids reading EXIF orientation if so configured'
do
begin
Paperclip
.
options
[
:use_exif_orientation
]
=
false
Paperclip
::
GeometryParser
.
stubs
(
:new
).
with
(
"300x200,1"
).
returns
(
stub
(
make: :correct
))
file
=
fixture_file
(
"rotated.jpg"
)
factory
=
Paperclip
::
GeometryDetector
.
new
(
file
)
output
=
factory
.
make
expect
(
output
).
to
eq
:correct
ensure
Paperclip
.
options
[
:use_exif_orientation
]
=
true
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