FIX: don't automagically downsize uploaded images that are larger than 10MB

FIX: don't optimize GIFs since ImageOption was disabled for GIFs (too slow)
This commit is contained in:
Régis Hanol
2015-11-26 18:16:47 +01:00
parent 2561b5f304
commit 09bfe49254
2 changed files with 13 additions and 9 deletions

View File

@@ -107,12 +107,12 @@ class Upload < ActiveRecord::Base
end
end
# optimize image
ImageOptim.new.optimize_image!(file.path) rescue nil
# correct size so it displays the optimized image size which is the only
# one that is stored
filesize = File.size(file.path)
# optimize image (but not for GIFs)
if filename !~ /\.GIF$/i
ImageOptim.new.optimize_image!(file.path) rescue nil
# update the file size
filesize = File.size(file.path)
end
end
# compute the sha of the file