PHPackages                             plan2net/webp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. plan2net/webp

ActiveTypo3-cms-extension[Image &amp; Media](/categories/media)

plan2net/webp
=============

Creates WebP copies for images (TYPO3 CMS)

13.0.1(10mo ago)661.4M↓12.8%39[13 issues](https://github.com/plan2net/webp/issues)[1 PRs](https://github.com/plan2net/webp/pulls)2GPL-3.0PHPPHP &gt;=8.2

Since Mar 14Pushed 8mo ago6 watchersCompare

[ Source](https://github.com/plan2net/webp)[ Packagist](https://packagist.org/packages/plan2net/webp)[ Docs](https://www.plan2.net/)[ RSS](/packages/plan2net-webp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (35)Used By (2)

WebP for TYPO3 CMS
==================

[](#webp-for-typo3-cms)

What does it do?
----------------

[](#what-does-it-do)

Adds an automagically created *WebP* copy for every processed jpg/jpeg/png/gif image in the format

```
original.ext.webp

```

What is WebP and why do I want it?
----------------------------------

[](#what-is-webp-and-why-do-i-want-it)

> WebP is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster.
>
> WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index.
>
> Lossless WebP supports transparency (also known as alpha channel) at a cost of just 22% additional bytes. For cases when lossy RGB compression is acceptable, lossy WebP also supports transparency, typically providing 3× smaller file sizes compared to PNG.

— source:

Installation
------------

[](#installation)

Add via composer:

```
composer require "plan2net/webp"

```

- Install and activate the extension in the Extension manager
- Flush TYPO3 and PHP Cache
- Clear the processed files in the Install Tool or Maintenance module
- Add rewrite rules for your webserver (see examples for Apache and nginx below)

Update
------

[](#update)

- Save the extension settings at least once (through `Admin Tools > Settings > Extension Configuration > webp`) after an update to save the new default settings in your local configuration

Requirements
------------

[](#requirements)

You can either use the installed Imagemagick or GraphicsMagick you already use for TYPO3 image manipulation if it supports webp (see below) or you can use any other external binary available on your server (e.g. [*cwebp*](https://developers.google.com/speed/webp/docs/cwebp)).

You can test the support of GraphicsMagick with e.g.:

```
gm version | grep WebP

```

(should return `yes`)

or using ImageMagick with e.g.:

```
convert version | grep webp

```

(should return a list of supported formats including `webp`)

These are examples, check your system documentation for further information on how to verify webp support on your platform.

Extension settings
------------------

[](#extension-settings)

[![Extension settings](Resources/Public/Documentation/extension_settings.png)](Resources/Public/Documentation/extension_settings.png)

You can set parameters for the conversion in the extension configuration.

### `parameters`

[](#parameters)

```
parameters = image/jpeg:-quality 85 -define webp:lossless=false|image/png:-quality 75 -define webp:lossless=true|image/gif::-quality 85 -define webp:lossless=true

```

You find a list of possible options here:

If you want to use an external binary, you have to supply an option string with exactly two `%s` placeholders for the original file and the target file name. E.g.:

```
image/jpeg::/usr/bin/cwebp -jpeg_like %s -o %s|image/png::/usr/bin/cwebp -lossless %s -o %s|image/gif::/usr/bin/gif2webp %s -o %s

```

*Warning*

Try to set a higher value for `quality` first if the image does not fit your expectations, before trying to use `webp:lossless=true`, as this could even lead to a higher filesize than the original!

### `convert_all`

[](#convert_all)

```
# cat=basic; type=boolean; label=Convert all images in local and writable storage and save a copy in Webp format; disable to convert images in the _processed_ folder only
convert_all = 1

```

Since version `1.1.0` all images in every local and writable storage will be saved as a copy in Webp format by default (instead of just images modified by TYPO3 in the storage's processed folder). If you want to revert to the previous behaviour, set this flag to `false` (disable the checkbox).

### `silent`

[](#silent)

```
# cat=basic; type=boolean; label=Suppress output (stdout, stderr) from the external converter command
silent = 1

```

Since version `2.2.0` you can suppress output (stdout, stderr) from the external converter (Linux only).

### `hide_webp`

[](#hide_webp)

```
# cat=basic; type=boolean; label=Hide .webp files in backend file list module
hide_webp = 1

```

`.webp` files are hidden by default in the backend file list module. If you want to show them to the users, disable this option.

If you need a more customized behaviour for hiding or showing the generated files (e.g. for a specific BE user group), you can always remove or change the `$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['defaultFilterCallbacks']` settings (see `ext_localconf.php` for details) in your own extension.

### `exclude_directories`

[](#exclude_directories)

```
# cat=basic; type=string; label=Exclude processing of images from specific directories (separated by semicolon)
exclude_directories =

```

Here you can exclude processing of images from specific directories. Example value: `/fileadmin/demo/special;/another-storage/demo/exclusive`

### `use_system_settings`

[](#use_system_settings)

```
# cat=basic; type=boolean; label=Use the system GFX "processor_stripColorProfileCommand"/"processor_stripColorProfileParameters" setting for the MagickConverter converter
use_system_settings = 1

```

When set (default) the value from `$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_stripColorProfileCommand']` or `$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_stripColorProfileParameters']` is appended automatically to the configuration options for the `MagickConverter` converter, so you don't need to repeat the settings.

Webserver example configuration
-------------------------------

[](#webserver-example-configuration)

Please **adapt** the following to *your specific needs*, this is **only an example** configuration.

### nginx

[](#nginx)

Add a map directive in your global nginx configuration:

```
map $http_accept $webp_suffix {
    default   "";
    "~*webp"  ".webp";
}

```

If you use *Cloudflare* the following might better suit your needs:

```
map $http_accept $webpok {
    default   0;
    "~*webp"  1;
}

map $http_cf_cache_status $iscf {
    default   1;
    ""        0;
}

map $webpok$iscf $webp_suffix {
    11          "";
    10          ".webp";
    01          "";
    00          "";
}

```

Add these rules to your `server` configuration:

```
location ~* ^.+\.(png|gif|jpe?g)$ {
        add_header Vary "Accept";
        add_header Cache-Control "public, no-transform";
        try_files $uri$webp_suffix $uri =404;
}

```

Make sure that there are no other rules that prevent further rules or already apply to the specified image formats and prevent further execution!

You can also add a browser restriction if your audience uses old versions of Safari, etc., so no *webp* is served to them.

```
location ~* ^.+\.(png|gif|jpe?g)$ {
    if ($http_user_agent !~* (Chrome|Firefox|Edge)) {
        set $webp_suffix "";
    }
    …

```

### Apache (.htaccess example)

[](#apache-htaccess-example)

We assume that module `mod_rewrite.c` is enabled.

```
RewriteEngine On
AddType image/webp .webp

```

is already part of the TYPO3 htaccess template in `typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess`

```
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(?i:png|gif|jpe?g)$
RewriteCond %{REQUEST_FILENAME}\.webp -f
RewriteRule ^ %{REQUEST_FILENAME}\.webp [L,T=image/webp]

        Header append Vary Accept

```

Make sure that there are no other rules that prevent further rules or already apply to the specified image formats and prevent further execution!

You can also add a browser restriction if your audience uses old versions of Safari, etc., so no *webp* is served to them.

```
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{HTTP_USER_AGENT} ^.*(Chrome|Firefox|Edge).*$ [NC]
…

```

Verify successful webp image generation and delivery
----------------------------------------------------

[](#verify-successful-webp-image-generation-and-delivery)

To make sure that everything works as expected you need to check two things:

1. WebP image generation on the webserver
2. successful delivery of WebP images to the client

### WebP image generation

[](#webp-image-generation)

Go to `fileadmin/_processed_` and check the subfolders for files with `.webp` extension. For every processed image file there should be a second file with the same filename plus `.webp` extension:

```
csm_foo-bar_4f3d6bb7d0.jpg
csm_foo-bar_4f3d6bb7d0.jpg.webp

```

### Delivery of WebP images to the client

[](#delivery-of-webp-images-to-the-client)

Open a processed jpg or png image (see above) in your browser, e.g. `https://domain.tld/fileadmin/_processed_/b/2/csm_foo-bar_4f3d6bb7d0.jpg`

Check the response headers in the developer tools of your browser. Despite the file suffix `.jpg`, you should get `Content-Type: image/webp`.

[![Extension settings](Resources/Public/Documentation/headers.png)](Resources/Public/Documentation/headers.png)

Troubleshooting and logging
---------------------------

[](#troubleshooting-and-logging)

If something does not work as expected take a look at the log file. Every problem is logged to the TYPO3 log (since version 2.0), normally found in `var/log/typo3_*.log`

Converted files that are larger than the original are removed automatically (since version 2.1.0) and the conversion will not be retried with the same configuration.

If you find that your webp images don't look like the original images (much darker, for example), make sure you have the correct profile set in the system setting `GFX/processor_colorspace` (e.g. `sRGB`). Remember to clean up any processed files after this change.

Removing processed files
------------------------

[](#removing-processed-files)

You can remove the created .webp files at any time within the TYPO3 CMS backend.

- Go to Admin Tools &gt; Remove Temporary Assets
- Click the *Scan temporary files* button
- In the modal click the button with the path of the storage

Although the button names only the path of the `_processed_` folder, all processed files of the storage are actually deleted!

Alternatives
------------

[](#alternatives)

You can get an equal result with using the Apache *mod\_pagespeed* or nginx *ngx\_pagespeed* modules from Google  with a configuration like:

```
pagespeed EnableFilters convert_jpeg_to_webp;
pagespeed EnableFilters convert_to_webp_lossless;

```

but that requires more knowledge to set up.

Drawbacks to keep in mind
-------------------------

[](#drawbacks-to-keep-in-mind)

Note that this extension produces an additional load on your server (each processed image is reprocessed) and possibly creates a lot of additional files that consume disk space (size varies depending on your! configuration).

Inspiration
-----------

[](#inspiration)

This extension was inspired by [Angela Dudtkowski](https://www.clickstorm.de/agentur/)'s *cs\_webp* extension that has some flaws and got no update since early 2017. Thanks Angela :-)

Thanks to Xavier Perseguers for the *Cloudflare* hint.

Thanks to Marcus Förster for simplifying the Apache rewrite rules.

Spread some love
----------------

[](#spread-some-love)

Send us a postcard from your favourite place and tell us how much you love TYPO3 and OpenSource:

> plan2net GmbH, Sieveringerstraße 37, 1190 Vienna, Austria

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance52

Moderate activity, may be stable

Popularity55

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 78.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~88 days

Recently: every ~114 days

Total

31

Last Release

322d ago

Major Versions

1.2.0 → 2.0.02019-12-14

2.2.3 → 3.0.02020-03-10

3.3.1 → 4.0.02021-10-04

4.2.0 → 5.0.02023-04-26

4.3.2 → 13.0.02025-06-30

PHP version history (4 changes)1.2.0PHP &gt;=7.0.0

3.0.0PHP &gt;=7.2.0

5.0.0PHP &gt;=8.1

13.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4ea950f22b43e010ba4f0a6effb0928a6a1d11f64d36cec0d030b757bdfa85e?d=identicon)[wazum](/maintainers/wazum)

![](https://www.gravatar.com/avatar/fdc5d7c9be0f04c0d84c56db1e263fb7cb88c40564a7c293f1a2d4aa543f0115?d=identicon)[plan2net@packagist](/maintainers/plan2net@packagist)

---

Top Contributors

[![wazum](https://avatars.githubusercontent.com/u/146727?v=4)](https://github.com/wazum "wazum (74 commits)")[![richardkrikler](https://avatars.githubusercontent.com/u/57064056?v=4)](https://github.com/richardkrikler "richardkrikler (4 commits)")[![infabo](https://avatars.githubusercontent.com/u/3999104?v=4)](https://github.com/infabo "infabo (3 commits)")[![masi](https://avatars.githubusercontent.com/u/690355?v=4)](https://github.com/masi "masi (2 commits)")[![georgringer](https://avatars.githubusercontent.com/u/1905663?v=4)](https://github.com/georgringer "georgringer (2 commits)")[![eliashaeussler](https://avatars.githubusercontent.com/u/16313625?v=4)](https://github.com/eliashaeussler "eliashaeussler (2 commits)")[![rubsilv](https://avatars.githubusercontent.com/u/39330651?v=4)](https://github.com/rubsilv "rubsilv (2 commits)")[![Patta](https://avatars.githubusercontent.com/u/2151127?v=4)](https://github.com/Patta "Patta (1 commits)")[![peterkraume](https://avatars.githubusercontent.com/u/4234704?v=4)](https://github.com/peterkraume "peterkraume (1 commits)")[![ischmittis](https://avatars.githubusercontent.com/u/904789?v=4)](https://github.com/ischmittis "ischmittis (1 commits)")[![Kanti](https://avatars.githubusercontent.com/u/471387?v=4)](https://github.com/Kanti "Kanti (1 commits)")[![franzkugelmann](https://avatars.githubusercontent.com/u/11320147?v=4)](https://github.com/franzkugelmann "franzkugelmann (1 commits)")

---

Tags

extensiontypo3webp

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/plan2net-webp/health.svg)

```
[![Health](https://phpackages.com/badges/plan2net-webp/health.svg)](https://phpackages.com/packages/plan2net-webp)
```

###  Alternatives

[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[christophlehmann/imageoptimizer

Optimize uploaded/processed images with binaries of your choice

46501.8k](/packages/christophlehmann-imageoptimizer)[sitegeist/sms-responsive-images

Provides ViewHelpers and configuration to render valid responsive images based on TYPO3's image cropping tool.

34493.1k2](/packages/sitegeist-sms-responsive-images)[lochmueller/focuspoint

Focuspoint integrate the focal point method to crop images in the frontend of the web page. Use the jQuery-focuspoint plugin (https://github.com/jonom/jquery-focuspoint example http://jonom.github.io/jquery-focuspoint/demos/helper/index.html) to crop the images. Use the function as wizard in the file list view and directly in the content element.

23179.1k](/packages/lochmueller-focuspoint)[smichaelsen/melon-images

Responsive Image Management

2489.3k](/packages/smichaelsen-melon-images)[schmitzal/tinyimg

Image compression for all pngs and jpgs uploaded to the backend (using the tinypng API)

16125.5k](/packages/schmitzal-tinyimg)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
