Generate WebP or AVIF
- Genera un archivo WebP o AVIF al añadir un archivo de imagen a la biblioteca de medios.
- Generate WebP or AVIF from all the images by async/await.
- Opcionalmente, puedes reemplazar los archivos de imagen por WebP al añadir nuevos medios y eliminar el archivo de imagen original. Además, al generar todas las imágenes, el archivo de la imagen original se eliminará y su ID se sobrescribirá como WebP o AVIF. Todas las URL en el contenido también se reemplazarán.
WP-CLI
WP-CLI commands are available. If you have a large number of files, WP-CLI commands is more reliable.
* wp pluswebpavif
* wp pluswebpavif webp -> Generated WebP.
* wp pluswebpavif avif -> Generated AVIF.
* wp pluswebpavif help -> Specification of this command.
* wp pluswebpavif webp mail -> Send results via email.
* wp pluswebpavif webp replace -> WebP or AVIF replacement of images and contents.
* wp pluswebpavif avif addext -> Append the webp or avif extension to the original filename.
* wp pluswebpavif webp --pid=12152 -> Process only specified Media ID(Conversion source ID).
* wp pluswebpavif avif --quality=90 -> Specifies the quality of WebP or AVIF.
* wp pluswebpavif webp --types=image/png,image/gif -> MIME type to convert.
How it works
Filter hooks
/** ==================================================
* Filter for advanced change database.
* If you want to replace other databases besides content.
*/
add_filter(
'plus_webp_advanced_change_db',
function( $before_url, $after_url ) {
/* Your processing */
return array( $before_url, $after_url );
},
10,
2
);
Te puedes descargar este plugin para utilizarlo en tu sitio de .