Report this

What is the reason for this report?

How to resize images on Spaces

Posted on May 30, 2019

Hi,

I just want to use Spaces like that;

blabla.digitalocean.com/1024x1024/images/image.jpg blabla.digitalocean.com/600x0/images/image.jpg

and it will give me cropped image as values.

How can it be possible? We can make it on AWS, but couldnt find any configuration field on Spaces.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I’m also seeking for a similar solution but i’m afraid that is not possible with DigitalOcean Spaces :(

Hi, if Spaces supported redirect bucket lifecycle rule you could redirect the request on a missing resource like

blabla.digitalocean.com/1024x1024/image.jpg to myapp.com/1024x1024/image.jpg

which could be a serverless application that would resize, serve and store missing image transformations on the fly. Ideally, this app should also check for allowed image transformations (e.g 1980x1020, 1024x768) to avoid some security issues.

Another solution would be to configure bucket with a custom subdomain like assets.myapp.com and put it behind Cloudflare. Cloudflare offers service called Workers which can execute some logic per each request. You can also resize images with workers.

If somebody has solved this issue elegantly please share;)

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.