Page 1 of 1

Releasing: Image Optimizer for Bludit (new plugin)

Posted: Thu May 28, 2026 10:58 pm
by foobarness
Here's another new plugin I am releasing. It should be easy to use even for non-coders. It should also do good for non-coders.

https://github.com/romland/bludit-media-optimizer

I use it myself! :-)

Re: Releasing: Image Optimizer for Bludit (new plugin)

Posted: Fri May 29, 2026 12:47 am
by kbeezie
Looks a little easier than my approach of doing a cli conversion to WebP , and then creating this nginx rule to serve the WebP if it's present, or fallback to the original jpeg if it's not, without redirect since you can just stream the content along with the header if the browser says it can accept WebP. (basically the conversion script at the CLI creates a copy of image.jpg as image.jpg.webp)

Needs a map in the main http { }

Code: Select all

# WebP content negotiation
        map $http_accept $webp_suffix {
            default    "";
            "~*image/webp" ".webp";
        }
Then at the server block for the site (the vary is important in case it needs to serve between jpg/png/jpeg or webp)

Code: Select all

       location ~* \.(png|jpg|jpeg)$ {
            try_files $uri$webp_suffix $uri @404static;
            expires max;
            add_header Vary Accept;
            add_header Access-Control-Allow-Origin "*";
            add_header X-Robots-Tag "noindex, nofollow";
            add_header Cache-Control "public, no-transform, immutable";
        }
Maybe that could work into your plugin as part of the documentation of using it on nginx to allow for a fallback to browsers that don't support webp, but if their header says they do, then serves the webp data down the same response stream. In this case your plugin would be doing the webp conversion, if giving an option for fallback-supported, not some cli tool.