By tomas
Hi The space that I created has a problem, when I enter the link of a specific image contained within the space, it automatically downloads it, I want the browser’s behavior to be able to view the image instead of downloading.
Another problem I have is performance, it takes a while to load new images, is there a solution for this?
Thanks, sorry my english.
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!
Accepted Answer
Hi Tomas,
Your issue with DigitalOcean Spaces where images are being downloaded instead of displayed in the browser usually relates to the Content-Type
header associated with your files. Additionally, the performance problem for loading new images might be related to how the images are being served or their sizes. Let’s address these issues one by one.
Check Content-Type
Header:
Content-Type
header. For images to display in the browser, this header should be set to the appropriate image MIME type (like image/jpeg
, image/png
, etc.).Content-Type
header using the DigitalOcean Control Panel or the s3cmd
tool with the --add-header
option.Modify Headers for Existing Files:
Content-Type
header is not set correctly, you’ll need to update it. This can be done manually via the Spaces control panel or programmatically via the Spaces API.Set Headers on Upload:
Content-Type
header.Optimize Image Size:
Caching:
Cache-Control
header for your images to be cached by browsers. This means after the first download, the image will be loaded from the cache rather than fetched from Spaces again.Content Delivery Network (CDN):
Check Network and Server Performance:
To update the Content-Type
header:
Key
to Content-Type
and Value
to the appropriate MIME type (e.g., image/jpeg
).For setting up CDN:
By adjusting the Content-Type
headers and improving how images are served (optimization, caching, CDN), you should be able to have the images display directly in the browser and improve their load times.
Let me know how it goes!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.