Class: Alchemy::Dragonfly::Processors::Thumbnail

Inherits:
Dragonfly::ImageMagick::Processors::Thumb
  • Object
show all
Defined in:
lib/alchemy/dragonfly/processors/thumbnail.rb

Instance Method Summary collapse

Instance Method Details

#args_for_geometry(geometry) ⇒ Object

due to a missing ImageMagick parameter animated GIFs were broken with the default Dragonfly Thumb processor



18
19
20
21
22
23
# File 'lib/alchemy/dragonfly/processors/thumbnail.rb', line 18

def args_for_geometry(geometry)
  # resize all frames in a GIF
  # @link https://imagemagick.org/script/command-line-options.php#coalesce
  # @link https://imagemagick.org/script/command-line-options.php#deconstruct
  (@content&.mime_type == "image/gif") ? "-coalesce #{super} -deconstruct" : super
end

#call(content, geometry, opts = {}) ⇒ Object



9
10
11
12
13
# File 'lib/alchemy/dragonfly/processors/thumbnail.rb', line 9

def call(content, geometry, opts = {})
  # store content into an instance variable to use it in args_for_geometry - method
  @content = content
  super
end