jlelse's Blog

Thoughts, stories and ideas

Published on in 💬 Micro
Reply to: A note by Henrique Dias
Share 

I use BunnyCDN as storage for my Micropub media endpoint, where I upload all the photos and other media files I publish on my blog. When I upload a new photo the media endpoint first uploads the original file with the name of it’s SHA-256 hash value (so when I upload the same file multiple times, it doesn’t create multiple files). When I upload an image (JPEG or PNG) it also gets optimized and resized to a maximum width of 2000 pixels using the Tinify API (and then uploaded to BunnyCDN too), doing that significantly reduces the file size of the images displayed on my blog.

It would be probably awesome to also serve different formats based on the Accept HTTP header (WebP for browsers that support it) or different sizes, but I decided I want to hold my perfectionism (and the complexity) in check and settle for using just one optimized file version in the original file format. If at some point all browsers support WebP, I might consider using only WebP files, but until then it still takes time.

At the moment I don’t backup the files from BunnyCDN (I trust that they - or I - don’t accidentally delete them), but I could probably setup a cron job to regularly copy new files via FTP from their storage to another storage.

Tags:

Jan-Lukas Else
Interactions
You can also create an anonymous comment.