Skip to content

Greite/wp-cubi-image-webp

Repository files navigation

Build Status Latest Stable Version License

Standalone image webp converter and provider WordPress plugin

wp-cubi

Overview

wp-cubi-image-webp is a very simple image converter and provider plugin for WordPress, meant to be used in a composer installation. It uses php gd extension to convert uploaded images into webp images (jpg and png).

Requirements

The PHP gd extension must be activated to convert images to webp

Installation

  • composer require globalis/wp-cubi-image-webp

Configuration using .htaccess

Insert this chunk of code into your .htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTP_ACCEPT} image/webp
  RewriteCond %{REQUEST_FILENAME}.webp -f
  RewriteRule (.+)\.(jpg|jpeg|png)$ $1.$2.webp [T=image/webp,NC,L]
</IfModule>

Configuration using URLs rewrite

Define WP_CUBI_IMAGE_WEBP_REWRITE_URL to true in your functions.php

Bulk optimization

Bulk image optimization can be done using wp-cli :

  • Install wp-cli and ensure wp-cubi-image-webp is activated
  • Usage: wp webp generate <directories>... [--force=<false|true>]
  • Help: wp help webp generate

About

Standalone image webp converter and provider WordPress plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages