move-elevator / typo3-image-compression
Automatically compress images using TinyPNG API, local tools (jpegoptim, optipng, etc.), or ImageMagick/GraphicsMagick
Package info
github.com/move-elevator/typo3-image-compression
Type:typo3-cms-extension
pkg:composer/move-elevator/typo3-image-compression
Requires
- php: ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
- ext-fileinfo: *
- doctrine/dbal: ^3.8 || ^4.0
- psr/container: ^1.1 || ^2.0
- psr/log: ^2.0 || ^3.0
- symfony/console: ^6.4 || ^7.0
- tinify/tinify: ^1.6
- typo3/cms-backend: ^12.4 || ^13.4 || ^14.0
- typo3/cms-core: ^12.4 || ^13.4 || ^14.0
- typo3/cms-extbase: ^12.4 || ^13.4 || ^14.0
- typo3/cms-filelist: ^12.4 || ^13.4 || ^14.0
- typo3/cms-fluid: ^12.4 || ^13.4 || ^14.0
- typo3/cms-frontend: ^12.4 || ^13.4 || ^14.0
- typo3/cms-reports: ^12.4 || ^13.4 || ^14.0
Requires (Dev)
- eliashaeussler/version-bumper: ^2.4 || ^3.0
- phpunit/phpcov: ^10.0 || ^11.0
- phpunit/phpunit: ^11.0 || ^12.0
- typo3/cms-lowlevel: ^12.4 || ^13.4 || ^14.0
This package is not auto-updated.
Last update: 2026-05-04 09:41:11 UTC
README
TYPO3 extension typo3_image_compression
This TYPO3 extension automatically compresses images uploaded to the TYPO3 backend. Choose between the TinyPNG API for best results or local tools for cost-free compression.
โจ Features
- Multiple compression providers: TinyPNG API, local optimized tools, or ImageMagick/GraphicsMagick
- Automatic compression of JPG, PNG, GIF, AVIF and WebP images on upload
- CLI command for batch processing existing images
- Configurable quality settings for local compression
- Image compression statistics in the system information toolbar
- Compression status visible in sys_file_metadata edit view
- System report with per-provider statistics in Admin Tools
๐ฅ Installation
Requirements: TYPO3 >= 12.4 ยท PHP 8.2+
Composer
composer require move-elevator/typo3-image-compression
TER
Download the zip file from the TYPO3 Extension Repository (TER).
โ๏ธ Configuration
Configure the extension in Admin Tools > Settings > Extension Configuration.
Provider overview
| Provider | Tools | Compression | Cost | Best for |
|---|---|---|---|---|
tinify |
TinyPNG API | ~70โ80% | API quota | Production, best quality |
local-tools |
jpegoptim, optipng, pngquant, gifsicle, cwebp | ~50โ60% | Free | Self-hosted, no API costs |
local-basic |
ImageMagick / GraphicsMagick | ~30โ40% | Free | JPEG only, quick setup |
tinify (TinyPNG API)
- Register at TinyPNG Developers to obtain your API key.
- Set Provider to
tinifyand enter your API key. - Free tier: 500 compressions/month โ upgrades available via the TinyPNG dashboard.
Warning
The free API limit (500 compressions/month) can be exhausted quickly on large sites with many existing images. Use the CLI --include-processed flag with caution.
local-tools (Optimized tools)
Install the required tools on your server:
# Debian/Ubuntu apt install jpegoptim optipng pngquant gifsicle webp # macOS (Homebrew) brew install jpegoptim optipng pngquant gifsicle webp
Set Provider to local-tools. The extension auto-detects available tools.
local-basic (ImageMagick / GraphicsMagick)
No additional installation needed โ uses TYPO3's configured graphics processor. Set Provider to local-basic.
Quality settings
For local providers, configure quality (1โ100) for JPEG, PNG, and WebP compression independently.
๐ก Usage
Automatic compression
Once configured, all images with a supported MIME type uploaded via the TYPO3 backend are automatically compressed.
Batch processing (CLI)
Use the CLI command to compress images that were uploaded before the extension was installed.
Important
Before running the CLI command, ensure your TYPO3 file index is up to date. Run the scheduler task "File Abstraction Layer: Update storage index" first.
# Compress up to 100 original images (default) vendor/bin/typo3 imagecompression:compressImages # Compress up to 50 images vendor/bin/typo3 imagecompression:compressImages 50 # Also compress processed files (thumbnails, crops, etc.) vendor/bin/typo3 imagecompression:compressImages --include-processed # Retry failed compressions vendor/bin/typo3 imagecompression:compressImages --retry-errors # Combine options vendor/bin/typo3 imagecompression:compressImages 200 --include-processed --retry-errors
| Argument / Option | Description |
|---|---|
limit |
Number of images to process (default: 100) |
--include-processed, -p |
Also compress processed files (thumbnails, crops). Omit to save API quota โ processed files are regenerated from already-compressed originals. |
--retry-errors, -r |
Retry compression for files that previously failed. Clears error status on success. |
Tip
When using the tinify provider, omit --include-processed to conserve your monthly API quota. Processed files are regenerated from the already-compressed originals anyway.
Backend integration
- System information toolbar โ displays current API usage (TinyPNG) or compression statistics.
- System Reports (
Admin Tools > System Reports) โ active provider, per-file-type statistics, and API usage. - File metadata (
sys_file_metadata) โ per-file compression status and error messages.
๐ Acknowledgments
This project is a fork and further development of the great tinyimg extension.
๐งโ๐ป Contributing
Please refer to CONTRIBUTING.md.
๐ License
This project is licensed under the GNU General Public License 2.0 (or later).