class Poto::Services::Resize

Attributes

height[R]
path[R]
width[R]

Public Class Methods

new(path:, width:, height:) click to toggle source
# File lib/poto/services/resize.rb, line 8
def initialize(path:, width:, height:)
  @path = path
  @width = width
  @height = height
end

Public Instance Methods

call() click to toggle source
# File lib/poto/services/resize.rb, line 14
def call
  image = MiniMagick::Image.open(path)
  image.resize([width, height].compact.join('x'))
  image.format('png')
  image.write(path)
  image.path
end