Slimage uses jpegoptim and optipng to compress your images during upload. It will compress the thumbnails that WordPress generates but will leave the original file intact, so that you can safely restore your changes if necessary.
The plugin will also allow you to manually set the compression level and quality on a per-image basis. That way you have absolute control on how much quality you are willing to sacrifice in order to achieve better performance improvements, which can be handy if you want to pass the Google PageSpeed test.
Using it in conjuction with the
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
optipng installed on your server and make sure that PHP
shell_exec() function isn’t disabled in your
- Compress an image during upload.
- You can set a default level of compression for all newly uploaded images.
- You can override that compression level on a per-image basis.
- You can use all the available options of jpegoptim and optipng.
- Combining it with some image regeneration tool, you can bulk compress your existing images.
- The plugin leaves the original image intact, so that any change that you make can be reversible.
- Install jpegoptim and optipng on your server.
- Make sure that shell_exec() is active on your php.ini (it usually is).
- Upload the Slimage plugin to your WordPress plugins directory and activate it.
- Go to Settings / Media and check the «Enable Slimage» under «Compress images with Slimage». If jpegoptim and optipng are installed on a custom path on your server, set that path under «Server path for jpegoptim & optipng».
Часто задаваемые вопросы
Can I bulk regenerate already uploaded images?
Yes. After you set your desired compression level on the plugin settings and save your changes, you can use the
wp media regeneratecommand 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.
Can I set different compression level for a specific image?
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.
Can I use this plugin if I don’t have jpegoptim or optipng installed on my server?
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).
Can I use this plugin if
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.
What extra arguments can I set?
Can I pass the Google Pagespeed test with that plugin?
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.
Нет отзывов об этом плагине.
Участники и разработчики
«Slimage» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:Участники
- CSS fix for better compatibility with ACF
- Check sizes existence to prevent PHP warning
- CSS fixes
- Moved project to Github (https://github.com/gsarig/slimage).
- Updated WP version compatibility.
- Initial release