Mô tả
Automatically optimize uploaded images (jpg, png, gif, webp, svg, avif) using the Spatie image-optimizer library and binary files on your host system.
New uploaded images with all image sizes (thumbnails) will be optimized automatically.
Previously uploaded images can be updated in two ways:
- Use the command line interface (cli) and run
wp media regenerate
, which also triggers the optimization chain. If you don’t have cli access, some other plugin, that regenerates existing thumbnails should work, too (not tested, yet). - The media library has a new column “File size” in the list view, which displays the new and the old file size. If an image is not optimized, there is a link named “Optimize” to run the optimizer directly.
Warning: Images are replaced with the optimized ones. Create a backup before testing this plugin. If this is a deal-breaker for you, don’t use it.
Important: If the needed binary files aren’t installed, this plugin won’t optimize anything. Don’t use it, if you don’t know, how to install them or if your web hoster doesn’t provide them.
Notice: WordPress has no support for SVG files. Technically this plugin can optimize them, but I didn’t run any tests with plugins, that add SVG support to WordPress. I was able to optimize svg files automatically in a local test setup (see prepare-and-run-tests.sh
in the tests folder and search for enable_svg_avif_upload
).
For more information and notes about development, checkout the project README.md file on Codeberg
Requirements
- PHP function
proc_open
must be enabled (some web hosts disable it viaphp.ini
)
Settings
Quality settings can be adjusted with constants in wp-config.php
:
Set quality for resizing images (GD/Imagick)
define('ASIO_RESIZE_QUALITY_JPEG', 100); // default: 82
define('ASIO_RESIZE_QUALITY_WEBP', 100); // default: 86
Set quality of optimizers
define('ASIO_QUALITY_JPEGOPTIM', 90); // default: 85
define('ASIO_QUALITY_PNGQUANT', 90); // default: 85
define('ASIO_QUALITY_CWEBP', 85); // default: 90
define('ASIO_QUALITY_AVIFENC', 70); // default: 63
Optimization tools
Spatie image-optimizer will use these optimizers if they are present on your system:
At least jpegoptim and optipng should be installed.
You can find information about how to install the binary files in the Spatie image-optimizer README.md file.
Đánh giá
Người đóng góp & Lập trình viên
“Another simple image optimizer” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.
Những người đóng góp“Another simple image optimizer” đã được dịch qua 1 ngôn ngữ. Cảm ơn những người tham gia dịch vì đóng góp của họ.
Dịch “Another simple image optimizer” sang ngôn ngữ của bạn.
Muốn tham gia phát triển?
Duyệt code, check out SVN repository, hoặc theo dõi nhật ký phát triển qua RSS.
Nhật ký thay đổi
PHP 8.1 is required since 0.2.0.
For more details see project CHANGELOG.md on Codeberg