Sha256: 118f18e90a3831a2e7a5a5c58536c20bf6e0105c5e4b863a386da41d4761f170

Contents?: true

Size: 716 Bytes

Versions: 96

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  class Picture < BaseRecord
    class Preprocessor
      def initialize(image_file)
        @image_file = image_file
      end

      # Preprocess images after upload
      #
      # Define preprocessing options in the Alchemy::Config
      #
      #   preprocess_image_resize [String] - Downsizing example: '1000x1000>'
      #
      def call
        max_image_size = Alchemy::Config.get(:preprocess_image_resize)
        image_file.thumb!(max_image_size) if max_image_size.present?
        # Auto orient the image so EXIF orientation data is taken into account
        image_file.auto_orient!
      end

      private

      attr_reader :image_file
    end
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
alchemy_cms-7.4.2 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.3.6 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.2.9 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.4.1 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.4.0 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.3.5 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.2.8 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.1.13 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.0.16 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.3.4 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.3.3 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.3.2 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.2.7 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.3.1 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.3.0 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.2.6 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.2.5 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.1.12 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-7.0.15 app/models/alchemy/picture/preprocessor.rb
alchemy_cms-6.1.10 app/models/alchemy/picture/preprocessor.rb