开发者 | gsarig |
---|---|
更新时间 | 2022年12月30日 03:41 |
捐献地址: | 去捐款 |
PHP版本: | 7.0 及以上 |
WordPress版本: | 6.1 |
版权: | GPLv2 or later |
wp media regenerate
command of WP-CLI or with some thumbnail regeneration plugin, you can bulk optimize your photos and even experiment until you find the combination of quality/size that suits you.
To use the plugin you need to have jpegoptim
and optipng
installed on your server and make sure that PHP shell_exec()
function isn't disabled in your php.ini
.
Features
Yes. After you set your desired compression level on the plugin settings and save your changes, you can use the wp media regenerate
command of the amazing WP-CLI to regenerate the thumbnails. If you don't feel comfortable with the command line and prefer to do it with a plugin, Force Regenerate Thumbnails and AJAX Thumbnail Rebuild have been tested and confirmed to play nice with Slimage.
Yes. On each image edit page there is an option called "Override quality" which allows you to set your specific settings for that particular image. After changing your image settings, you still need to regenerate its thumbnails in order to run the compression.
If neither jpegoptim nor optipng exist on your server, then the plugin won't work. It won't break your site, but it will not do anything (except from showing a related warning message on it's settings page). If only one of the tools exists, then it will use it to process the specific type of images only (JPEGs for jpegoptim and PNGs for optipng).
shell_exec()
isn't enabled on my php.ini?No. The plugin relies on the PHP shell_exec()
function which is by default enabled by most hosting companies. If, in your case, it is disabled, you will not be able to use it. Again, this will not break your site.
Yes. But you might need to make some compromise on the quality of your photos. For JPEGs, setting the quality level to 50 or 60 is enough to pass the test on most cases. Depending on the complexity of the image, though, on some cases the quality loss might be visible to the naked eye so you might need to experiment with the level of quality.