netlogix / nximageoptimizer
Optimize images when they are processed by the resource publisher
Installs: 17 094
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 6
Forks: 0
Open Issues: 3
Type:typo3-cms-extension
Requires
- php: ^8.1
- typo3/cms-core: ^12.4
Requires (Dev)
- ext-sqlite3: *
- netlogix/coding-guidelines-php: ^1.0
- phpunit/phpcov: ^9.0
- ssch/typo3-rector: ^1.5
- typo3/testing-framework: ^8.0
- dev-master
- 5.0.0
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- v3.x-dev
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.0
- 2.2.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- 1.0.0
- dev-dependabot/composer/ssch/typo3-rector-tw-2.6
- dev-dependabot/github_actions/saschanowak/CloverCodeCoverageSummary-1.0.1
- dev-dependabot/github_actions/peter-evans/create-pull-request-6.0.5
This package is auto-updated.
Last update: 2024-11-29 08:02:27 UTC
README
This TYPO3 extension optimizes images (jpg, png, gif, svg) for web presentation when they are published. It will generate WebP versions of each rendered image and serve them to the client.
Compatibility
The current version (dev-master) of this extension has been tested in TYPO3 12 on PHP 8.1, 8.2 and 8.3.
Requirements
This extension requires additional third-party tools.
- jpegoptim: utility to optimize/compress JPEG files
- optipng: OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information
- pngquant: pngquant is a command-line utility and a library for lossy compression of PNG images
- svgo: Node.js tool for optimizing SVG files
- gifsicle: Create, manipulate, and optimize GIF images and animations
You should install them using your package manager of choice.
Ubuntu Example
The following is an example installation on Ubuntu:
sudo apt-get install jpegoptim optipng pngquant gifsicle sudo npm install -g svgo
macOS Example (using Homebrew)
brew install jpegoptim brew install optipng brew install pngquant brew install svgo brew install gifsicle
macOS Example (using MacPorts)
port install jpegoptim port install optipng port install pngquant port install svgo port install gifsicle
Installation
Install the package via composer.
composer require netlogix/nximageoptimizer
Place the following in your .htaccess file and images will be replaced with WebP version.
# Check if browser support WebP images # Check if WebP replacement image exists # Serve WebP image instead RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{DOCUMENT_ROOT}/$0.webp -f RewriteRule (.+)\.(jpe?g|png)$ $0.webp [T=image/webp,E=accept:1]
Tell every caching proxy to cache based on "accept" header
RewriteRule (.+)\.(jpe?g|png|webp)$ - [env=POTENTIAL_WEBP_IMAGE:1] Header merge vary accept env=POTENTIAL_WEBP_IMAGE
Troubleshooting
The Ubuntu source package for imagemagick does not declare a build dependency on libwebp-dev. Thus imagemagick gets built without webp support. To fix this install the webp package.
sudo apt-get install webp