Question

How to resize images on Spaces

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.

Subscribe
Share

Submit an 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.

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;)

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