I would like to compress the image when its size is larger than the sum (i.e. 1,000,000 - 1 MB). I see that compression is used with the write method in the Image object. I have an image in memory and I do not want to write it on my server, but on Amazon S3.
This code works. It uploads the image to my s3 path, however I would like to enable size checking and compression:
photo = Magick::Image.read(mmkResourceImage.href).first
s3 = AWS::S3.new
bucket = s3.buckets[bucketName]
obj = bucket.objects[key]
obj.write(photo)
Please let me know if there is another approach for this.
Rober source
share