Skip to content

Commit

Permalink
Unconditionally re-encode locally-uploaded images to strip metadata
Browse files Browse the repository at this point in the history
This strips metadata on file upload by re-encoding the files, at the cost
of possible slight image quality decrease and processing resources.
  • Loading branch information
ClearlyClaire committed Sep 17, 2018
1 parent 657805f commit 382cdd7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/paperclip/lazy_thumbnail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def make
private

def needs_convert?
needs_different_geometry? || needs_different_format?
needs_different_geometry? || needs_different_format? || needs_metadata_stripping?
end

def needs_different_geometry?
Expand All @@ -31,5 +31,9 @@ def needs_different_geometry?
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

0 comments on commit 382cdd7

Please sign in to comment.