Ask A Question

Notifications

You’re not receiving notifications from this thread.

Which gem is the best for dynamic image resizing from an S3 URL?

Robert White asked in General

Hi,
Which gem is the best for dynamic image resizing from an S3 URL? I know i can pre define this, but I have hundreds of people using the product with endless uses cases I'd like them to specify the width in a url parameter, then cache the image for later use.

Note I am using CarrierWave and Fog currently to handle the upload process, perhaps I can leverage one of these gems?

Reply

Refile actually provides a Sinatra app that will let you do this. https://github.com/refile/refile#processing

Using something Shrine, I imagine you can build a plugin to do that similarly.

Be awere that you're definitely going to want to cache this to a CDN because you do not want to have to process an image every single request. That's way too much unnecessary work, so you want to do it the first time and then have it cached in the CDN.

Another option would be to generate say 5 different sizes and let the user specify the dimensions, but use CSS to resize the image in the browser and grab the smallest size that fits those dimensions.

Reply

Thank you. I'll look into all those options.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.