mageplaza/module-image-optimizer

This package is abandoned and no longer maintained. No replacement package was suggested.

Magento 2 Image Optimizer Extension

Installs: 7 751

Dependents: 0

Suggesters: 0

Security: 0

Stars: 8

Watchers: 5

Forks: 3

Open Issues: 3

Type:magento2-module

1.0.1 2020-02-24 10:16 UTC

This package is auto-updated.

Last update: 2020-06-24 09:20:28 UTC


README

Image Optimizer can be considered as a must-have module for Magento 2 stores which have the need to compress and optimize their images. By optimizing the images, you will have the ability to reduce the page loading time, enhance the shopping experience as well as grow the conversion rate considerably.

1. Documentation

2. FAQ

Q: I got an error: Mageplaza_Core has been already defined

A: Read solution here

Q: What image types are supported by Image Optimizer?

A: Most common image types are supported, including PNG, JPG, and GIF.

Q: Can you please let me know about the optimization process?

A: At first, all files (of the directories that are included) will be scanned. After that, the scanned images will be optimized.

Q: Is it possible to set up the optimization process to be automated by a specific schedule?

A: Yes, it is absolutely possible. With the help of cron, the schedule to scan and optimize the image can be set on a regular basis.

Q: How is the quality of the image after optimizing?

A: Using Image Optimizer, you will have two options, which are Lossless and Custom. Choosing Lossless, you can reduce the size of the image while still retaining the quality of that image. On the contrary, you can define the quality percent of optimized images with the Custom option. However, please keep in mind that small file size equal with worse image quality.

3. How to install Image Optimizer extension for Magento 2

Install via composer (recommend). Run the following command in Magento 2 root folder:

composer require mageplaza/module-image-optimizer
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy

4. Highlight Features

Optimize multiple types of images

Optimize multiple types of images

With Magento 2 Image Optimizer, various types of images such as PNG, JPG, and GIF can be compressed easily by the store admins. These three image types are the most common formats which are used by thousands of online stores to upload the pictures of their products and services. With compressed image size, you will be able to better your store site’s performance.

Control image quality: lossless or lossy

Control image quality

Setting the compression level is the most interesting feature of the Image Optimizer extension. There are two compression options which create different image quality and file size output that you can use: Lossless and Lossy.

On the one hand, Lossless is an option which allows admin to retain the quantity of image while downsizing its size. More specifically, by removing unnecessary meta data from image files, the file size will be decreased marginally.

On the other hand, Custom compression, also known as Lossy, will help you to reduce the file size dramatically. However, there will be a loss in the data of the original image file; in other words, the quality of the image will be affected. When the Image Optimizer extension is applied to your store, the retained proportion of quality after the compression process can be set without a visible loss in image quality. As a result, you can retain full control of image quality as well as the compression level.

Process optimization automatically

Process optimization automatically

You can activate the image compression on a regular basis by running cron. Thanks to this, the admin will no longer need to compress images manually.

Image Optimizer will scan all the available images and notify you about the optimization status. After that, this module will activate the optimization process to scan than compress images in certain times. Store admins will be able to save a great amount of time with this automated operation.

Back up original images

Back up original images

To ensure the safety of original images, modifications should accompany with backup. With Image Optimizer, all images will be stored in an image directory, and store admins can roll-back any image and use it at any time if necessary.

The backup feature allows admins to freely modify the image without worrying about the original picture being lost.

Included and excluded images directories

Included and excluded images directories

In addition, you can also assign the image scan to certain directories of your site. From the admin backend, admins can include all directories which have the images being scanned and exclude ones which you would like to keep images from scanning.

Thanks to this separation, the scanning process will become much more time-saving and focussing. The directories which require original pictures with full quality will not be counted in the optimization process.

5. More Features

Force File Permission

Approve/ Disapprove permission for compressed file.

Skip Transparent Image

Allow skipping the transparent image during the process of optimization

Record, Requeue And Restore

All scanned paths, original size, optimized size, optimization status, optimized percent, error message are recorded. Also, the status of the optimized image can also be changed to pending and re-optimize. Besides, the optimized images can also be restored to original images.

Run Manually

By selecting the Optimize button at the Manage Images grid, you will be able to optimize images manually.

Bulk Compress

Allow multiple image paths and compress to be selected at the same time.

Command Line

Command-line is supported for quick and convenient image optimization.

6. Full Feature List

For Store Admins

General

  • Turn on/ off the module
  • Turn on/ off image backup feature

Optimize Options

  • Choose the quality of compressed images: Lossless or Custom
  • Choose quality proportion of images after the optimization process
  • Enable/ Disable skipping transparent images
  • Enable/ Disable force file permission

Directory

  • Included directory whose images are scanned
  • Excluded directories whose images are scanned

Cron Job

  • Allow/ Disallow scanning images
  • Set the schedule for scanning
  • Allow/ Disallow image optimization
  • Set the schedule for optimization

Manage Images

  • Allow viewing scanned image paths
  • Allow viewing image status after scanning and optimizing
  • Allow viewing the size of the original and optimized file
  • Allow viewing optimization percent
  • Allow viewing error messages during optimizing
  • Allow changing images to pending status
  • Allow restoring images to original status
  • Allow viewing progressing percent according to status: Pending, Error, Skipped, Success
  • Display popup when compressing multiple images in bulk or click on optimize button
  • Apply command line to optimize images quickly and conveniently

For Customers

  • Access the information on the page faster
  • Stop wasting too much of time for page loading
  • Experience good shopping time

7. User Guide

How to Configure

1. Configuration

Login to the Admin Magento, choose Stores > Image Optimizer > Configuration

1.1. General

  • Enable: Select Yes to use the module features. Support image types: JPG, PNG, GIF, TIF, BMP.
  • Backup Image: If Yes is selected, the original image will be backed up at var/ backup_image directory before being optimized.
1.2. Optimize Options

  • Image Quality: select the image optimization level, including 2 types:
    • Custom: a filter which help to remove some data. Noted that this will reduce the image quality so you should be careful with the level of image quality reduction as the image can be blurry and unclear. Choosing Custom will show more fields:
      • Quality Percent: Enter the percent in the Quality percent field which will be limited between 1 and 100. For good image quality, please maintain quality above 90. If left blank, default value is 92.
  • Lossless: is a data compression filter. This does not reduce image quality but it will require uncompressed images before they can be rendered.
  • Skip Transparent Images: If yes is selected, the white image or transparent image will be skipped during the optimization process. If you want to optimzie these transparent photos, you must Restore and Requeue them. The second way is just choosing "No" in this field, all the transparent images will be optimized too.
  • Force File Permission:
    • If No is selected, there is no change on the image permission.
    • Select Yes to provide permission for optimized images. Choose Yes will show more fields:
      • Select Permission:
        • Enter the number presenting the permission in the Select Permission field to choose the permission types for optimized images. You can refer more information here. Example: 0755, ...
    • This is a required field.
1.3. Scan Directory

  • Included Directories:
    • Click Add button to enter the path into the path field. The entered paths will be scanned with images in that path. For example: pub/media/catalog/product, pub/media/customer.
    • If left blank, the system will scan the default directory of pub/media/. Click Remove to delete the entered path.
  • Excluded Directories:
    • Select Add button to enter the path where you don't want to scan the image in that folder. For example: pub/media/mageplaza, pub/ media/logo.
    • If left blank, there is no limit to scan images with paths. Click Remove to delete the path if you still want to optimize the path.
  • Note: If the path is in both Excluded Directories and Included Directories, then the scan with that path will not apply.
1.4. Cron job

  • Enable Image Scan: Select yes to automatically scan images after a certain period of time and display additional fields:
    • Scan Schedule: Enter the time in the Scan Schedule field, after the selected time will automatically scan the image. You can refer to this link. For example:
      • Enter ***** is every 1 minute automatically scan the image.
      • 20 * / 3 * * * is running every 3 hours on 20 minutes will scan the image.
      • Run Daily: is 00 ***. It will be run at 00:00 daily
      • Run Weekly: 00 ** 7 will be run at 00:00 Sunday, 00 ** 1 will be run at 00:00 Monday
      • Run Month: 001 ** will be run at 00:00 on 01/01/2019. Note: When entering values, between two values linked by spaces, start running scans. For example: * * * * *
  • Enable Optimization: Select yes to automatically optimize with scanned images after a certain time and display additional fields:
    • Optimization Schedule: Enter the time in Optimization Schedule field, after the selected time will automatically optimize the scanned images. Unscanned images will not be optimized. The time period entered in Optimization Schedule field is the same as the Scan Schedule field, you can refer to above.
    • Limit Number of Images: Enter the number of photos that each time you want to automatically optimize after the selected time period.

2. Manage Images

  • Login to the Admin Magento, choose Stores > Image Optimizer > Manage Images
  • Here recorded and statistics scanned image information and Optimize or not include information of the fields: Path, Status, Original Size, Optimized Size, Compression Level (%), Error Message , ....

  • Click Scan Images button to start scaning all images. Only optimize the scanned images.
  • Choose Optimize Images button to optimize with the scanned images.
  • With Optimize Action, you can choose optimize with each image or all scanned images without optimizing, the optimized images will not be optimized anymore.
  • If Restore, the image returns to skipped status and will ignore the optimize image. - Re-Queue: the image returns to the pending state.
  • Delete: Delete images that you don't want to optimize.
  • Progress: recounting the status of the photo with Pending, Error, Skipped, Success.
  • Display popup when clicking Mass Action Optimized or button Optimize Image. When Optimize is clicked, the Progress bar displays 0%, and displays the first image. Click Stop if you want to stop the pptimize process.

  • Display the popup when clicking Stop with message Are you sure you want to stop optimizing images?

3. Command line

It is possible to run the following command to optimize images quickly, conveniently and the number of images after each optimize will be based on the value of the Limit Number of Images field in the Configuration section:

php bin/magento mpimageoptimizer:optimize

Also, please run the following command to scan images following the confiruration at the field Scan Directory:

php bin/magento mpimageoptimizer:scan