From cd8d82aa319532a58e6e78bc6e526bc1643297e6 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 10 Sep 2015 14:37:46 +1000 Subject: [PATCH] correct file size and add note about impending breakage of image_optim --- Gemfile | 3 ++- Gemfile.lock | 5 ++++- app/models/upload.rb | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index e8b2403e5..233268918 100644 --- a/Gemfile +++ b/Gemfile @@ -63,7 +63,8 @@ gem 'email_reply_parser' # note: for image_optim to correctly work you need to follow # https://github.com/toy/image_optim -gem 'image_optim' +# pinned due to https://github.com/toy/image_optim/pull/75, docker image must be upgraded to upgrade +gem 'image_optim', '0.20.2' gem 'multi_json' gem 'mustache' gem 'nokogiri' diff --git a/Gemfile.lock b/Gemfile.lock index 338070cfa..44397f9df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -422,7 +422,7 @@ DEPENDENCIES highline hiredis htmlentities - image_optim + image_optim (= 0.20.2) librarian (>= 0.0.25) listen (= 0.7.3) logster @@ -488,3 +488,6 @@ DEPENDENCIES uglifier unf unicorn + +BUNDLED WITH + 1.10.6 diff --git a/app/models/upload.rb b/app/models/upload.rb index 59a647f76..39e5fb94e 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -100,6 +100,10 @@ class Upload < ActiveRecord::Base # 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) end # compute the sha of the file