Sha256: b35390f8168fc7ee579d61846da06ced80e246743e96a976de93df4cd50ac91c

Contents?: true

Size: 343 Bytes

Versions: 1

Compression:

Stored size: 343 Bytes

Contents

require 'mini_magick'

class Harmony::Service::Utils::Image
  def resize(uri, max_file_size)
    output_filepath = "/tmp/output.#{DateTime.now.strftime('%Q')}.png"
    image = MiniMagick::Image.open(uri)
    image.define "extent=#{max_file_size}"
    image.format 'jpeg'
    image.write output_filepath
    File.new(output_filepath)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harmony-service-0.8.0 lib/harmony/service/utils/image.rb