Skip to main content

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

General • Asked by Robert White

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?


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.


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


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.