Class: ActiveStorage::Analyzer::ImageAnalyzer::Vips
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::ActiveStorage::Analyzer::ImageAnalyzer,
::ActiveSupport::Autoload,
Analyzer
|
|
|
Instance Chain:
self,
::ActiveStorage::Analyzer::ImageAnalyzer,
Analyzer
|
|
| Inherits: |
ActiveStorage::Analyzer::ImageAnalyzer
|
| Defined in: | activestorage/lib/active_storage/analyzer/image_analyzer/vips.rb |
Overview
Constant Summary
-
ROTATIONS =
# File 'activestorage/lib/active_storage/analyzer/image_analyzer/vips.rb', line 58/Right-top|Left-bottom|Top-right|Bottom-left/
Class Method Summary
::ActiveStorage::Analyzer::ImageAnalyzer - Inherited
::ActiveSupport::Autoload - Extended
Instance Method Summary
- #read_image private
- #rotated_image?(image) ⇒ Boolean private
::ActiveStorage::Analyzer::ImageAnalyzer - Inherited
Class Method Details
.accept?(blob) ⇒ Boolean
# File 'activestorage/lib/active_storage/analyzer/image_analyzer/vips.rb', line 24
def self.accept?(blob) super && ActiveStorage.variant_processor == :vips end
Instance Method Details
#read_image (private)
[ GitHub ]# File 'activestorage/lib/active_storage/analyzer/image_analyzer/vips.rb', line 29
def read_image unless VIPS_AVAILABLE logger.error "Skipping image analysis because the ruby-vips gem isn't installed" return {} end download_blob_to_tempfile do |file| image = instrument("vips") do # ruby-vips will raise Vips::Error if it can't find an appropriate loader for the file ::Vips::Image.new_from_file(file.path, access: :sequential) rescue ::Vips::Error logger.info "Skipping image analysis because Vips doesn't support the file" nil end if image yield image else {} end rescue ::Vips::Error => error logger.error "Skipping image analysis due to a Vips error: #{error.}" {} end rescue ::Vips::Error => error logger.error "Skipping image analysis due to an Vips error: #{error.}" {} end