Class: Blobsterix::Transformations::Impl::MaxsizeImage

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



84
85
86
# File 'lib/blobsterix/transformation/image_transformation.rb', line 84

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

#nameObject



81
82
83
# File 'lib/blobsterix/transformation/image_transformation.rb', line 81

def name()
  "resizemax"
end

#output_typeObject



88
89
90
# File 'lib/blobsterix/transformation/image_transformation.rb', line 88

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

#transform(input_path, target_path, value) ⇒ Object



92
93
94
95
96
# File 'lib/blobsterix/transformation/image_transformation.rb', line 92

def transform(input_path, target_path, value)
  image = MiniMagick::Image.open(input_path)
  image.resize "#{value}>"
  image.write target_path
end