83% iloveimg

Code Review | Image Compressor & Optimizer - iLoveIMG

WordPress plugin Image Compressor & Optimizer - iLoveIMG scored83%from 54 tests.

About plugin

  • Plugin page: iloveimg
  • Plugin version: 2.0.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4.1
  • WordPress version: 6.3.1
  • First release: Jun 13, 2019
  • Latest release: Nov 14, 2023
  • Number of updates: 26
  • Update frequency: every 62.2 days
  • Top authors: ilovepdf (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active /7,995 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.22MB] [CPU: ▼3.36ms] Passed 4 tests

This is a short check of server-side resources used by Image Compressor & Optimizer - iLoveIMG
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.64 ▲0.1837.34 ▼5.43
Dashboard /wp-admin3.54 ▲0.2053.56 ▼0.58
Posts /wp-admin/edit.php3.66 ▲0.3046.47 ▼1.94
Add New Post /wp-admin/post-new.php6.14 ▲0.2690.54 ▼5.49
Media Library /wp-admin/upload.php3.48 ▲0.2535.51 ▲3.27
Bulk Optimization /wp-admin/upload.php?page=iloveimg-media-page3.4735.55
Watermark settings /wp-admin/admin.php?page=iloveimg-watermark-admin-page3.5033.09
Compress settings /wp-admin/admin.php?page=iloveimg-compress-admin-page3.5131.12

Server storage [IO: ▲0.56MB] [DB: ▲0.00MB] Passed 3 tests

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 111 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
ilove_img_compress_db_version
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
iloveimg_options_compress
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Image Compressor & Optimizer - iLoveIMG
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,842 ▲9514.15 ▼0.091.74 ▲0.0542.58 ▼1.92
Dashboard /wp-admin2,232 ▲545.65 ▲0.0697.43 ▼17.32112.68 ▲71.65
Posts /wp-admin/edit.php2,167 ▲642.03 ▲0.0040.67 ▼0.8946.11 ▲10.93
Add New Post /wp-admin/post-new.php1,570 ▲4423.31 ▲0.04703.55 ▲86.2270.29 ▲19.92
Media Library /wp-admin/upload.php1,471 ▲774.22 ▼0.1299.89 ▲3.6392.14 ▲49.23
Bulk Optimization /wp-admin/upload.php?page=iloveimg-media-page1,1452.0830.2851.05
Watermark settings /wp-admin/admin.php?page=iloveimg-watermark-admin-page1,1952.3427.5041.45
Compress settings /wp-admin/admin.php?page=iloveimg-compress-admin-page1,4351.8427.7649.12

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • ilove_img_compress_db_version
    • iloveimg_options_compress
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 53× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/tests/Iloveimg/IloveTest.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/tests/Iloveimg/IloveimgTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'WP_List_Table' not found in wp-content/plugins/iloveimg/admin/Ilove_Img_Compress_Media_List_Table.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Iloveimg\\Iloveimg' not found in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/src/ImageTask.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Ilove_Img_Compress\\Ilove_Img_Compress_Media_List_Table' not found in wp-content/plugins/iloveimg/admin/views/media-bulk.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/tests/Iloveimg/FileTest.php:8
    • > PHP Warning
      require_once(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/samples/try_catch_errors.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'Iloveimg\\ImageTask' not found in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/src/CropImageTask.php:9
    • > PHP Warning
      require_once(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/samples/repair_basic.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'Iloveimg\\Exceptions\\ExtendedException' not found in wp-content/plugins/iloveimg/vendor/ilovepdf/iloveimg-php/src/Exceptions/AuthException.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots lack descriptions #1, #2, #3, #4 in iloveimg/assets to your readme.txt
The official readme.txt is a good inspiration

iloveimg/ilove-img-compress.php 77% from 13 tests

Analyzing the main PHP file in "Image Compressor & Optimizer - iLoveIMG" version 2.0.1
You should first fix the following items:
  • Description: Keep the plugin description shorter than 140 characters (currently 445 characters long)
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("iloveimg.php" instead of "ilove-img-compress.php")
  • Domain Path: The domain path folder was not found ("/languages")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin5,889 lines of code in 104 files:
LanguageFilesBlank linesComment linesLines of code
PHP709302,2323,794
Sass73213960
JSON400466
SVG10010238
JavaScript21124154
Markdown3680152
XML30071
YAML42053
CSS1001

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity10.67
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.48
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces8
Interfaces1
Traits0
Classes38
▷ Abstract classes00.00%
▷ Concrete classes38100.00%
▷ Final classes00.00%
Methods257
▷ Static methods8231.91%
▷ Public methods23892.61%
▷ Protected methods41.56%
▷ Private methods155.84%
Functions6
▷ Named functions350.00%
▷ Anonymous functions350.00%
Constants48
▷ Global constants612.50%
▷ Class constants4287.50%
▷ Public constants42100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There are no PNG files in this plugin