diff --git a/Gemfile b/Gemfile index 85a247356..1d69d4c50 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,7 @@ gem "honeycomb-beeline", "~> 2.4.0" # Monitoring and Observability gem gem "html_truncator", "~> 0.4" # Truncate an HTML string properly gem "htmlentities", "~> 4.3", ">= 4.3.4" # A module for encoding and decoding (X)HTML entities gem "httparty", "~> 0.18" # Makes http fun! Also, makes consuming restful web services dead easy -gem "imgproxy", "~> 1.2" # A gem that easily generates imgproxy URLs for your images +gem "imgproxy", "~> 2.0" # A gem that easily generates imgproxy URLs for your images gem "inline_svg", "~> 1.7" # Embed SVG documents in your Rails views and style them with CSS gem "jbuilder", "~> 2.11" # Create JSON structures via a Builder-style DSL gem "jquery-rails", "~> 4.4" # A gem to automate using jQuery with Rails diff --git a/Gemfile.lock b/Gemfile.lock index 3a6b4c994..c5d254cdc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,6 +109,8 @@ GEM amazing_print (1.2.2) ancestry (3.2.1) activerecord (>= 4.2.0) + anyway_config (2.1.0) + ruby-next-core (>= 0.11.0) approvals (0.0.24) nokogiri (~> 1.6) thor (~> 0.18) @@ -400,7 +402,8 @@ GEM image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - imgproxy (1.2.0) + imgproxy (2.0.0) + anyway_config (>= 2.0.0) inline_svg (1.7.2) activesupport (>= 3.0) nokogiri (>= 1.6) @@ -685,6 +688,7 @@ GEM rubocop-rspec (2.2.0) rubocop (~> 1.0) rubocop-ast (>= 1.1.0) + ruby-next-core (0.12.0) ruby-prof (1.4.3) ruby-progressbar (1.11.0) ruby-statistics (2.1.3) @@ -913,7 +917,7 @@ DEPENDENCIES htmlentities (~> 4.3, >= 4.3.4) httparty (~> 0.18) hypershield (~> 0.2.2) - imgproxy (~> 1.2) + imgproxy (~> 2.0) inline_svg (~> 1.7) jbuilder (~> 2.11) jquery-rails (~> 4.4) diff --git a/app/services/images/optimizer.rb b/app/services/images/optimizer.rb index 5d96cfbe2..1b4b90d1d 100644 --- a/app/services/images/optimizer.rb +++ b/app/services/images/optimizer.rb @@ -50,6 +50,7 @@ module Images options[:resizing_type] = "fill" end + options[:crop] = nil options end diff --git a/config/initializers/1_imgproxy.rb b/config/initializers/1_imgproxy.rb index 20ade5dd1..bb3f7bb25 100644 --- a/config/initializers/1_imgproxy.rb +++ b/config/initializers/1_imgproxy.rb @@ -11,9 +11,9 @@ Imgproxy.configure do |config| # If unsure, check out https://github.com/imgproxy/imgproxy/blob/master/docs/configuration.md first. # Hex-encoded signature key - config.hex_key = ApplicationConfig["IMGPROXY_KEY"] + config.key = ApplicationConfig["IMGPROXY_KEY"] # Hex-encoded signature salt - config.hex_salt = ApplicationConfig["IMGPROXY_SALT"] + config.salt = ApplicationConfig["IMGPROXY_SALT"] # Base64 encode all URLs config.base64_encode_urls = true diff --git a/lib/data_update_scripts/20210305222641_resave_users_for_imgproxy_update.rb b/lib/data_update_scripts/20210305222641_resave_users_for_imgproxy_update.rb new file mode 100644 index 000000000..222d6d91a --- /dev/null +++ b/lib/data_update_scripts/20210305222641_resave_users_for_imgproxy_update.rb @@ -0,0 +1,9 @@ +module DataUpdateScripts + class ResaveUsersForImgproxyUpdate + def run + return if SiteConfig.dev_to? + + User.find_each(&:save) + end + end +end diff --git a/spec/services/images/optimizer_spec.rb b/spec/services/images/optimizer_spec.rb index f26524cd4..5ac26b9ac 100644 --- a/spec/services/images/optimizer_spec.rb +++ b/spec/services/images/optimizer_spec.rb @@ -62,7 +62,7 @@ RSpec.describe Images::Optimizer, type: :service do describe "#imgproxy" do it "works" do allow(described_class).to receive(:imgproxy_enabled?).and_return(true) - imgproxy_url = described_class.imgproxy(image_url, service: :imgproxy, width: 500, height: 500) + imgproxy_url = described_class.imgproxy(image_url, width: 500, height: 500) expect(imgproxy_url).to match(%r{/s:500:500/mb:500000/aHR0cHM6Ly9pLmlt/Z3VyLmNvbS9mS1lL/Z280LnBuZw}) end end diff --git a/vendor/cache/anyway_config-2.1.0.gem b/vendor/cache/anyway_config-2.1.0.gem new file mode 100644 index 000000000..fde9a37cc Binary files /dev/null and b/vendor/cache/anyway_config-2.1.0.gem differ diff --git a/vendor/cache/imgproxy-1.2.0.gem b/vendor/cache/imgproxy-1.2.0.gem deleted file mode 100644 index 4bd9d628f..000000000 Binary files a/vendor/cache/imgproxy-1.2.0.gem and /dev/null differ diff --git a/vendor/cache/imgproxy-2.0.0.gem b/vendor/cache/imgproxy-2.0.0.gem new file mode 100644 index 000000000..eacbe45a9 Binary files /dev/null and b/vendor/cache/imgproxy-2.0.0.gem differ diff --git a/vendor/cache/ruby-next-core-0.12.0.gem b/vendor/cache/ruby-next-core-0.12.0.gem new file mode 100644 index 000000000..25195efba Binary files /dev/null and b/vendor/cache/ruby-next-core-0.12.0.gem differ