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.
Tinify or TinyPNG or TinyJPEG is the service I use to automatically compress and resize images uploaded to my micropub media endpoint. It’s a great service with a nice developer API that also offers a free limit of 500 compressions per month and has a pay-what-you-use policy after that (but I won’t upload more than 500 images per month anyway). I use a library written in Go to use the API.
🖼️ Read more