• Resolved homu9

    (@homu9)


    Hi,
    Could we use “Prevent using webps larger than original” in cli?
    Or could we use cli based on the UI settings?
    Or is there a way to delete all .webp bigger than origin?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author rosell.dk

    (@roselldk)

    Short answer:
    It works the same way for CLI as in UI

    Long answer:
    The option is actually not used when generating conversions. The webp files are always kept, even if they are bigger. This applies to CLI as well as UI. The decision whether to use the webp or the original is taken later.

    Details of how it works:
    Upon conversion, it is examined if the webp is bigger than the original. In case it is, a dummy file will be put into wp-content/webp-express/webp-images-bigger-than-source/relative/path/to/original. This is done both for CLI conversions and UI conversions. Upon reconversions that results in smaller web, the file is deleted. If you have enabled the “Prevent using webps larger than original”, an extra rule will be put into the htacess rules, which skips redirection to webp in case such a file exists. The existence of such a file is also checked in Alter HTML.

    Thread Starter homu9

    (@homu9)

    Thanks for the explanation!
    I’m using webp express as a pure conversion tool (CDN friendly mode).
    The redirection to webp is handled by a Cloudflare worker:
    https://403.ie/how-to-support-webp-on-cloudflares-edge-with-a-worker/
    So webp of images in dynamic CSS could be served too.
    I guess the reason for keeping the webp version is to determine whether an image has been converted, so it doesn’t need to recorded in the database.
    I’ll try to add a compare logic to Cloudflare worker to solve this.
    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Could we use “Prevent using webps larger than original” in cli?’ is closed to new replies.