Class: Blobsterix::Transformations::Impl::ResizeImage

Inherits:
Transformation
  • Object
show all
Defined in:
lib/blobsterix/transformation/image_transformation.rb

Instance Method Summary collapse

Methods inherited from Transformation

#is_format?, #to_s

Methods included from Logable

#logger, #logger=

Instance Method Details

#input_typeObject



65
66
67
# File 'lib/blobsterix/transformation/image_transformation.rb', line 65

def input_type()
  @input_type ||= Blobsterix::AcceptType.new "image/*"
end

#nameObject



62
63
64
# File 'lib/blobsterix/transformation/image_transformation.rb', line 62

def name()
  "resize"
end

#output_typeObject



69
70
71
# File 'lib/blobsterix/transformation/image_transformation.rb', line 69

def output_type()
  @output_type ||= Blobsterix::AcceptType.new "image/*"
end

#transform(input_path, target_path, value) ⇒ Object



73
74
75
76
77
# File 'lib/blobsterix/transformation/image_transformation.rb', line 73

def transform(input_path, target_path, value)
  image = MiniMagick::Image.open(input_path)
  image.resize value
  image.write target_path
end