Module: Spotlight::ImageDerivatives
- Included in:
- BlacklightConfiguration, ItemUploader, Resources::Upload, SolrDocument::SpotlightImages::Versions
- Defined in:
- app/models/concerns/spotlight/image_derivatives.rb
Overview
Include Spotlight::ImageDerivatives in a class or module to get the derivative configurations in #spotlight_image_derivatives. A new derivative could theoretically be added by putting the following in an initializer. Spotlight::ImageDerivatives.spotlight_image_derivatives << {
version: :my_version,
field: :my_field,
lambda: lambda {|_|
version :my_version do
process :resize_to_fill => [30,30]
end
}
}
This will then create that new CarrierWave version in any class that extends this module and calls the apply_spotlight_image_derivative_versions class method described below.
Instance Method Summary collapse
-
#apply_spotlight_image_derivative_versions ⇒ Object
Extend Spotlight::ImageDerivatives in a CarrierWave uploader then you can call this as a class method and all of the configured versions will be available.
Instance Method Details
#apply_spotlight_image_derivative_versions ⇒ Object
Extend Spotlight::ImageDerivatives in a CarrierWave uploader then you can call this as a class method and all of the configured versions will be available
25 26 27 28 29 30 31 |
# File 'app/models/concerns/spotlight/image_derivatives.rb', line 25 def apply_spotlight_image_derivative_versions spotlight_image_derivatives.each do |version_config| if (c = version_config[:lambda]).present? class_eval(&c) end end end |