lib/harmony/service/utils/image.rb in harmony-service-0.8.0 vs lib/harmony/service/utils/image.rb in harmony-service-0.8.1
- old
+ new
@@ -1,12 +1,12 @@
require 'mini_magick'
class Harmony::Service::Utils::Image
- def resize(uri, max_file_size)
+ def resize(uri, max_file_size, format: 'jpeg')
output_filepath = "/tmp/output.#{DateTime.now.strftime('%Q')}.png"
image = MiniMagick::Image.open(uri)
image.define "extent=#{max_file_size}"
- image.format 'jpeg'
+ image.format format
image.write output_filepath
File.new(output_filepath)
end
end