Skip to content

Latest commit

 

History

History
98 lines (76 loc) · 2.56 KB

File metadata and controls

98 lines (76 loc) · 2.56 KB

Upgrading to imgproxy.rb 2.0

imgproxy.rb 2.0 brings several breaking changes. Here are some things you need to know to safely upgrade from version 1.x to 2.0.

  • If you use key and salt config options to provide raw (not hex-encoded) key/salt pair, use raw_key and raw_salt instead.

    Was:

    Imgproxy.configure do |config|
      config.key = "your_raw_key"
      config.salt = "your_raw_salt"
    end

    Becomes:

    Imgproxy.configure do |config|
      config.raw_key = "your_raw_key"
      config.raw_salt = "your_raw_salt"
    end
  • If you use hex_key and hex_salt config options to provide hex-encoded key/salt pair, use key and salt instead.

    Was:

    Imgproxy.configure do |config|
      config.hex_key = "your_key"
      config.hex_salt = "your_salt"
    end

    Becomes:

    Imgproxy.configure do |config|
      config.key = "your_key"
      config.salt = "your_salt"
    end
  • If you use complex processing options with multiple arguments like crop, gravity, watermark, etc, rewrite their usage according to the Complex processing options chapter in the gem's documentation.

    Was:

    Imgproxy.url_for(
      image_url,
      crop_width: 500,
      crop_height: 600,
      crop_gravity: :nowe,
      watermark_opacity: 0.5,
      watermark_scale: 0.3
    )

    Becomes:

    Imgproxy.url_for(
      image_url,
      crop: { width: 500, height: 600, gravity: { type: :nowe } },
      watermark: { opacity: 0.5, scale: 0.3 }
    )
  • If you use integration with Active Storage, put gem "imgproxy" after gem "rails" in your Gemfile and remove Imgproxy.extend_active_storage! from your initializer. Active Storage support is enabled automatically since the version 2.0.

  • If you use integration with Shrine, put gem "imgproxy" after gem "shrine" in your Gemfile and remove Imgproxy.extend_shrine! from your initializer. Shrine support is enabled automatically since the version 2.0.

  • If you use additional options for the Active Storage or Shrine integrations, move them to centralized config under Imgproxy.configure.

    Was:

    Imgproxy.extend_active_storage!(
      use_s3: true,
      use_gcs: true,
      gcs_bucket: "my_bucket"
    )
    
    Imgproxy.extend_shrine!(
      host: "http://your-host.test",
      use_s3: true
    )

    Becomes:

    Imgproxy.configure do |config|
      config.use_s3_urls = true
      config.use_gcs_urls = true
      config.gcs_bucket = "my_bucket"
      config.shrine_host = "http://your-host.test"
    end