Class: Alchemy::Picture::Preprocessor

Inherits:
Object
  • Object
show all
Defined in:
app/models/alchemy/picture/preprocessor.rb

Instance Method Summary collapse

Constructor Details

#initialize(image_file) ⇒ Preprocessor

Returns a new instance of Preprocessor.



6
7
8
# File 'app/models/alchemy/picture/preprocessor.rb', line 6

def initialize(image_file)
  @image_file = image_file
end

Instance Method Details

#callObject

Preprocess images after upload

Define preprocessing options in the Alchemy::Config

preprocess_image_resize [String] - Downsizing example: '1000x1000>'


16
17
18
19
20
21
# File 'app/models/alchemy/picture/preprocessor.rb', line 16

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