Class: ActiveStorage::Transformers::ImageProcessingTransformer
Relationships & Source Files | |
Namespace Children | |
Exceptions:
| |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Transformer
|
|
Instance Chain:
self,
Transformer
|
|
Inherits: |
ActiveStorage::Transformers::Transformer
|
Defined in: | activestorage/lib/active_storage/transformers/image_processing_transformer.rb |
Class Method Summary
Transformer
- Inherited
Instance Attribute Summary
Transformer
- Inherited
Instance Method Summary
Transformer
- Inherited
#transform | Applies the transformations to the source image in |
#process | Returns an open Tempfile containing a transformed image in the given |
Constructor Details
This class inherits a constructor from ActiveStorage::Transformers::Transformer
Instance Method Details
#operations
[ GitHub ]# File 'activestorage/lib/active_storage/transformers/image_processing_transformer.rb', line 28
def operations transformations.each_with_object([]) do |(name, argument), list| validate_transformation(name, argument) if argument.present? list << [ name, argument ] end end end
#process(file, format:)
[ GitHub ]# File 'activestorage/lib/active_storage/transformers/image_processing_transformer.rb', line 19
def process(file, format:) processor. source(file). loader(page: 0). convert(format). apply(operations). call end
#validate_transformation(name, argument)
[ GitHub ]# File 'activestorage/lib/active_storage/transformers/image_processing_transformer.rb', line 38
def validate_transformation(name, argument) if name.to_s == "combine_options" raise ArgumentError, <<~ERROR.squish Active Storage's ImageProcessing transformer doesn't support :combine_options, as it always generates a single command. ERROR end end