diff options
author | ThibG <thib@sitedethib.com> | 2018-09-17 20:24:46 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2018-09-17 21:09:59 +0200 |
commit | 382cdd7f959480d59fee5646be320d6076cb18d8 (patch) | |
tree | 866bcad1cc985c0277d09e53027030f3c4a84fcc /lib | |
parent | 657805f444ffd8d1cc0a36e0c37276a01611dc26 (diff) |
Unconditionally re-encode locally-uploaded images to strip metadata
This strips metadata on file upload by re-encoding the files, at the cost of possible slight image quality decrease and processing resources.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/paperclip/lazy_thumbnail.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/paperclip/lazy_thumbnail.rb b/lib/paperclip/lazy_thumbnail.rb index ea675a5bf..542c17fb2 100644 --- a/lib/paperclip/lazy_thumbnail.rb +++ b/lib/paperclip/lazy_thumbnail.rb @@ -20,7 +20,7 @@ module Paperclip private def needs_convert? - needs_different_geometry? || needs_different_format? + needs_different_geometry? || needs_different_format? || needs_metadata_stripping? end def needs_different_geometry? @@ -31,5 +31,9 @@ module Paperclip def needs_different_format? @format.present? && @current_format != @format end + + def needs_metadata_stripping? + @attachment.instance.respond_to?(:local?) && @attachment.instance.local? + end end end |