Class: Utopia::Gallery::ResizeVector

Inherits:
ResizeImage show all
Defined in:
lib/utopia/gallery/process.rb

Instance Attribute Summary

Attributes inherited from ResizeImage

#method, #options, #size

Attributes inherited from Process

#name

Instance Method Summary collapse

Methods inherited from ResizeImage

#call

Methods inherited from Process

fresh?, link, mtime

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, **options)
	super(*args, **options)
	@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