How to make images and PDF compression in PrestaShop
PrestaShop Image and PDF compression script upload
The PrestaShop image and PDF compression is possible using a script. This script is compatible with all the servers that run PHP, all CMS, it's a standalone installation. It means that you just need to upload a folder of files on your server, then you can start to compress all images and PDF of this server. The script can be downloaded here and you can activate a free trial account to test the Prestashop compression.
The script can be downloaded here:
Then download + unzip the archive and drop the folder on your server.
Run the installation
You can now call the folder path from your browser typing the URL: www.mywebsite.com/ImageRecycle-Standalone (default name). The install routine will be called, you need to define a password to secure folder access.
Setup your password, it can be anything, nothing related to your PrestaShop install. That should lead you to a success message.
Add API credentials to active PrestaShop compression
First, you'll need to add your API key and secret available on My account > API and Quota menu.
Setup the PrestaShop image and PDF compression quality
Then you can select a type of compression per media type:
- Best saving or Lossy: this is the best choice for a final usage, super compression yet not visible
- Lossless: if you have plan to reuse images, you can use this setting, light compression but preserve all image data (like colors)
- No compression: does not apply any compression on this media type
For more information about compression quality refer to this page: www.imagerecycle.com/images-and-pdf-optimization/images-and-pdf-compress
Setup a cron task to make the compression automatic
A Cron task is a scheduled commands or tasks also known as “Cron Jobs" or "crontab".
A Cron URL is available in the script configuration to launch the PrestaShop image and PDF optimization automatically. Depending of the Cron task setup, you can choose when you want launch the compression on your server. For an automatic compression you need to add this URL on your hosting Cpanel, sech for "Cron task" or "Crontab".
Image Metadata, IPTC and PrestaShop compression
The Metadata settings are also available to preserve some of the meta information of your images. For example you may want to preserve location information to use your images with a photo locator module?
Exclude / Include folders from PrestaShop compression
Finally, you need to select where you want to run the optimization, which server folder will be compressed. This is usually at least the PrestaShop image folders but that can be any folder listed (even from other CMS).
All your server folders under the ImageRecycle install are listed here, click on the name to deploy the folder tree. All new media added in those folders will be checked and listed in the next step for optimization.
Run the PrestaShop image and PDF compression
Here we are, hit the top menu Images to list the optimizable media, if nothing is there hit the button SYNC ALL or try the filter field (top left).
Then use optimize button to check everything is OK, you should be able to compress media and do a "revert to original". The revert option is available only during the media backup time (1 month).
You can also launch a global optimization of your media. It's a background process, so you can close the window, the process will still be executed anyway.
And you can stop the compression process when you want.