Class: ActiveStorage::HotCell::Client::Analyzers::Image

Inherits:
Analyzer
  • Object
show all
Includes:
Analyzing
Defined in:
lib/active_storage/hot_cell/client/analyzers/image.rb,
lib/active_storage/hot_cell/client/analyzers/image/vips.rb,
lib/active_storage/hot_cell/client/analyzers/image/magick.rb

Overview

Shipping an analyzer is mandatory rather than a nicety. The built-in image analyzers gate accept? on variant_processor being :vips or :mini_magick, so a class value makes all of them decline, analyzer_class falls through to NullAnalyzer, and the blob is marked analyzed with no dimensions at all. rails/rails#58384 leaves that to us deliberately.

This holds the Rails-facing contract — which blobs are accepted, which keys are written. A leaf names the client that reaches its toolchain and differs in nothing else.

Defined Under Namespace

Classes: Magick, Vips

Constant Summary collapse

KEYS =

Width and height, which is exactly what the built-in analyzer returns. The cell knows more — page count, whether the image is animated — and surfacing it would change the shape of every blob's metadata.

%i[ width height ].freeze

Class Method Summary collapse

Methods included from Analyzing

included, #metadata

Class Method Details

.accept?(blob) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/active_storage/hot_cell/client/analyzers/image.rb', line 27

def self.accept?(blob)
  blob.image?
end