Class: Utopia::Gallery::ResizeVector
- Inherits:
-
ResizeImage
- Object
- Process
- ResizeImage
- Utopia::Gallery::ResizeVector
- Defined in:
- lib/utopia/gallery/process.rb
Instance Attribute Summary
Attributes inherited from ResizeImage
Attributes inherited from Process
Instance Method Summary collapse
- #generate_output(resizer, output_path) ⇒ Object
-
#initialize(*args, extension: ".png", scale: 1, **options) ⇒ ResizeVector
constructor
A new instance of ResizeVector.
- #relative_path(media) ⇒ Object
- #resizer_for(input_path) ⇒ Object
Methods inherited from ResizeImage
Methods inherited from Process
Constructor Details
#initialize(*args, extension: ".png", scale: 1, **options) ⇒ ResizeVector
Returns a new instance of ResizeVector.
116 117 118 119 120 |
# File 'lib/utopia/gallery/process.rb', line 116 def initialize(*args, extension: ".png", scale: 1, **) super(*args, **) @extension = extension @scale = scale end |
Instance Method Details
#generate_output(resizer, output_path) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/utopia/gallery/process.rb', line 126 def generate_output(resizer, output_path) if output_image = resizer.send(@method, @size) output_image.write_to_file output_path, **@options else resizer.input_image.write_to_file output_path, **@options end end |
#relative_path(media) ⇒ Object
122 123 124 |
# File 'lib/utopia/gallery/process.rb', line 122 def relative_path(media) super + @extension end |
#resizer_for(input_path) ⇒ Object
134 135 136 |
# File 'lib/utopia/gallery/process.rb', line 134 def resizer_for(input_path) Vips::Thumbnail::Resizer.new(input_path, scale: @scale) end |