diff options
author | ThibG <thib@sitedethib.com> | 2018-09-17 20:24:46 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-09-17 20:24:46 +0200 |
commit | 9b32898e3c9e9284baa0792d0d7ee5723c860c4f (patch) | |
tree | 81629baa523ebc1c7ff5fcd245434a8cc0f28ba0 /lib/paperclip/lazy_thumbnail.rb | |
parent | d16c3342cef767c88acde8e78d3321c5b17dd85f (diff) |
Unconditionally re-encode locally-uploaded images to strip metadata (#8714)
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/paperclip/lazy_thumbnail.rb')
-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 |