73% wp-image-compression

Code Review | JPG, PNG Compression and Optimization

WordPress plugin JPG, PNG Compression and Optimization scored73%from 54 tests.

About plugin

  • Plugin page: wp-image-compression
  • Plugin version: 1.7.35
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-5.0
  • WordPress version: 6.3.1
  • First release: Mar 7, 2015
  • Latest release: Feb 6, 2019
  • Number of updates: 97
  • Update frequency: every 14.8 days
  • Top authors: pigeonhut (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

900+ active /48,437 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▼0.08MB] [CPU: ▼12.85ms] Passed 4 tests

Server-side resources used by JPG, PNG Compression and Optimization
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1542.26 ▼16.26
Dashboard /wp-admin3.35 ▲0.0554.25 ▼9.44
Posts /wp-admin/edit.php3.40 ▼0.4454.09 ▼8.80
Add New Post /wp-admin/post-new.php5.93 ▲0.04107.91 ▼16.90
Media Library /wp-admin/upload.php3.28 ▲0.0541.85 ▲6.79

Server storage [IO: ▲1.48MB] [DB: ▲0.07MB] Passed 3 tests

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 144 new files
Database: 2 new tables, 6 new options
New tables
wp_image_compression_details
wp_image_compression_settings
New WordPress options
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for JPG, PNG Compression and Optimization
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲4414.10 ▲0.131.74 ▼0.1548.03 ▲1.25
Dashboard /wp-admin2,211 ▲345.56 ▼0.04102.29 ▼3.0144.80 ▼7.30
Posts /wp-admin/edit.php2,116 ▲162.05 ▲0.0639.69 ▲0.7636.21 ▼0.80
Add New Post /wp-admin/post-new.php1,563 ▲3722.75 ▼1.01714.18 ▲1.4464.35 ▼5.18
Media Library /wp-admin/upload.php1,431 ▲314.31 ▲0.15135.97 ▲28.7559.05 ▲9.92

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • The uninstall procedure failed, leaving 2 tables in the database
    • wp_image_compression_details
    • wp_image_compression_settings
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 41× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelException' not found in wp-content/plugins/wp-image-compression/vendor/lsolesen/pel/src/PelInvalidDataException.php:45
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelEntry' not found in wp-content/plugins/wp-image-compression/vendor/lsolesen/pel/src/PelEntryVersion.php:68
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelEntryNumber' not found in wp-content/plugins/wp-image-compression/vendor/lsolesen/pel/src/PelEntryShort.php:57
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-image-compression/wp-image-compression.php on line 50
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelEntry' not found in wp-content/plugins/wp-image-compression/vendor/lsolesen/pel/src/PelEntryUndefined.php:50
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelEntryUndefined' not found in wp-content/plugins/wp-image-compression/vendor/lsolesen/pel/src/PelEntryUserComment.php:69
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/wp-image-compression/views/api-settings.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelEntryLong' not found in wp-content/plugins/wp-image-compression/vendor/lsolesen/pel/src/PelEntryRational.php:61
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelException' not found in wp-content/plugins/wp-image-compression/vendor/lsolesen/pel/src/PelIfdException.php:43
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-image-compression/lib/class-wp-image-compression.php:1129

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that need to be fixed:
  • Screenshots: These screenshots require images: #1 (Original 107KB), #2 (Compressed 82.6KB), #3 (Original 6000px 5.7MB), #4 (Resized and Compressed (1024px) 115KB)
  • Tags: There are too many tags (11 tag instead of maximum 10)
The official readme.txt might help

wp-image-compression/wp-image-compression.php Passed 13 tests

This is the main PHP file of "JPG, PNG Compression and Optimization" version 1.7.35, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
59 characters long description:
Image Compression and resizing - Setup under the Tools menu

Code Analysis 97% from 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
Good job! No executable or dangerous file extensions detected13,753 lines of code in 123 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript511,2482206,019
PHP591,4857,0575,964
CSS7205341,285
Markdown11660342
JSON20095
YAML26027
XML10021

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 146)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity17.37
▷ Minimum class complexity1.00
▷ Maximum class complexity146.00
Average method complexity3.62
▷ Minimum method complexity1.00
▷ Maximum method complexity146.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes46
▷ Abstract classes24.35%
▷ Concrete classes4495.65%
▷ Final classes00.00%
Methods290
▷ Static methods6622.76%
▷ Public methods27594.83%
▷ Protected methods20.69%
▷ Private methods134.48%
Functions28
▷ Named functions2796.43%
▷ Anonymous functions13.57%
Constants240
▷ Global constants125.00%
▷ Class constants22895.00%
▷ Public constants228100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
4 PNG files occupy 0.07MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/logo-optimisation.png3.97KB3.99KB0.00%
images/logo-optimisation-line.png0.85KB1.07KB0.00%
images/map-pin.png66.89KB23.84KB▼ 64.36%
images/icon-support.png0.76KB0.76KB0.13%