One of the tasks left for me to improve the sustainability of my website is to reduce the size/transfer of the images on my site. This is actually two tasks: optimize the images themselves, two lazy load images so they only load when scrolled into view.

I’m not too interested in lazy-loading images as it would require adding more Javascript and client-side execution. So I plan to focus on optimizing images in place for now.

My blog is powered by WordPress, so it should be as simple as installing one of the many “image optimizer” plugins. However, for a variety of reasons, including but not limited to image optimizing happens on their servers, or they want to use their CDN to delivery my images, or the plugin just kinda looks spammy, I haven’t taken the next time.

My designed image processing shouldn’t be too difficult – just call pngcrush and imagemagick depending on if I upload a png or jpeg file.

I’ve asked myself how do I address image optimization on my website: do I write my own image optimization plugin? Or do I do something else?

I haven’t written PHP in a very long time I don’t partially fancy developing a new WordPress plugin. But it could be nice to make a nice, clean, no fuss plugin available for others to use.

However, I’m leaning towards “something else” and think a more generic solution might be better. i.e. What if I had a small daemon (probably Python, maybe Rust as an excuse to learn it?) to monitor a directory and automatically optimize the images when they’re saved. This way no plugin is required and it could be used no matter the blogging engine.

Leave a Reply

Your email address will not be published. Required fields are marked *