62% compress-images-with-squeezeimg

Code Review | Compress Images with Squeezeimg (Webp/Jp2/Avif)

WordPress plugin Compress Images with Squeezeimg (Webp/Jp2/Avif) scored62%from 54 tests.

About plugin

  • Plugin page: compress-images-w...
  • Plugin version: 1.0.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.1-6.0
  • WordPress version: 6.3.1
  • First release: Jul 20, 2021
  • Latest release: Jul 6, 2022
  • Number of updates: 23
  • Update frequency: every 15.3 days
  • Top authors: squeezeimg (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,132 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.10MB] [CPU: ▼22.15ms] Passed 4 tests

An overview of server-side resources used by Compress Images with Squeezeimg (Webp/Jp2/Avif)
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.06 ▲0.6042.05 ▼1.90
Dashboard /wp-admin3.90 ▲0.5651.69 ▼14.09
Posts /wp-admin/edit.php3.95 ▲0.6052.40 ▼1.27
Add New Post /wp-admin/post-new.php3.72 ▼2.1737.82 ▼71.35
Media Library /wp-admin/upload.php3.83 ▲0.6046.98 ▲12.44
Images Compress Squeezeimg /wp-admin/upload.php?page=wp-imagecompress-media3.7942.65
Image Compress Squeezeimg /wp-admin/options-general.php?page=wp-imagecompress-settings4.05302.51

Server storage [IO: ▲0.55MB] [DB: ▲0.02MB] Passed 3 tests

Filesystem and database footprint
The plugin installed successfully
Filesystem: 58 new files
Database: 2 new tables, 6 new options
New tables
imagecompress_settings
wp_image_compress_squeezeimg_replace
New WordPress options
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

Compress Images with Squeezeimg (Webp/Jp2/Avif): an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,884 ▲13813.83 ▼0.398.58 ▲6.9442.72 ▼2.07
Dashboard /wp-admin2,207 ▲305.60 ▼0.0288.20 ▼5.8039.17 ▼1.68
Posts /wp-admin/edit.php2,115 ▲182.03 ▲0.0642.69 ▲5.3434.74 ▼1.27
Add New Post /wp-admin/post-new.php1,536 ▲823.10 ▼0.10684.15 ▼28.1651.63 ▼0.04
Media Library /wp-admin/upload.php1,415 ▲184.23 ▲0.1498.70 ▼20.7643.50 ▼1.62
Images Compress Squeezeimg /wp-admin/upload.php?page=wp-imagecompress-media1,0172.0527.0222.96
Image Compress Squeezeimg /wp-admin/options-general.php?page=wp-imagecompress-settings2,2311.9229.4329.76

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_image_compress_squeezeimg_replace
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/upload.php?page=wp-imagecompress-media
    • > Warning in wp-content/plugins/compress-images-with-squeezeimg/admin/partials/imagecompresssqueezeimg-admin-media.php+62
    Division by zero

SRP 0% 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
The following issues need your attention
  • 4× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/compress-images-with-squeezeimg/admin/partials/modal/back.php
    • > /wp-content/plugins/compress-images-with-squeezeimg/admin/partials/modal/header.php
    • > /wp-content/plugins/compress-images-with-squeezeimg/config/getimage.php
    • > /wp-content/plugins/compress-images-with-squeezeimg/public/partials/imagecompresssqueezeimg-public-display.php
  • 16× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant IMAGECOMPRESSSQUEEZ_PLUGIN_BASENAME - assumed 'IMAGECOMPRESSSQUEEZ_PLUGIN_BASENAME' (this will throw an Error in a future version of PHP) in wp-content/plugins/compress-images-with-squeezeimg/includes/class-imagecompresssqueezeimg-ajax.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function images_compress_squeezeimg\\get_home_url() in wp-content/plugins/compress-images-with-squeezeimg/includes/images_compress_squeezeimg/images.php:7
    • > PHP Warning
      require_once(IMAGECOMPRESSSQUEEZ_PLUGIN_DIR/includes/class-imagecompresssqueezeimg-db.php): failed to open stream: No such file or directory in wp-content/plugins/compress-images-with-squeezeimg/admin/partials/imagecompresssqueezeimg-admin-media.php on line 2
    • > PHP Warning
      Use of undefined constant IMAGECOMPRESSSQUEEZ_PLUGIN_DIR - assumed 'IMAGECOMPRESSSQUEEZ_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/compress-images-with-squeezeimg/includes/class-imagecompresssqueezeimg-ajax.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Imagecompresspro\\plugin_dir_path() in wp-content/plugins/compress-images-with-squeezeimg/imagecompresssqueezeimg-plugin.php:4
    • > PHP Fatal error
      require_once(): Failed opening required 'IMAGECOMPRESSSQUEEZ_PLUGIN_DIRhelper/IMAGECOMPRESSSQUEEZ_PLUGIN_BASENAME-modal-constructor.php' (include_path='.:/usr/share/php') in wp-content/plugins/compress-images-with-squeezeimg/includes/class-imagecompresssqueezeimg-ajax.php on line 5
    • > PHP Warning
      require_once(IMAGECOMPRESSSQUEEZ_PLUGIN_DIR/includes/class-imagecompresssqueezeimg-db.php): failed to open stream: No such file or directory in wp-content/plugins/compress-images-with-squeezeimg/admin/partials/imagecompresssqueezeimg-admin-display.php on line 2
    • > PHP Warning
      Use of undefined constant IMAGECOMPRESSSQUEEZ_PLUGIN_DIR - assumed 'IMAGECOMPRESSSQUEEZ_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/compress-images-with-squeezeimg/admin/partials/imagecompresssqueezeimg-admin-display.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/compress-images-with-squeezeimg/admin/class-imagecompresssqueezeimg-admin.php:13
    • > PHP Fatal error
      require_once(): Failed opening required 'IMAGECOMPRESSSQUEEZ_PLUGIN_DIR/includes/class-imagecompresssqueezeimg-db.php' (include_path='.:/usr/share/php') in wp-content/plugins/compress-images-with-squeezeimg/admin/partials/imagecompresssqueezeimg-admin-display.php on line 2

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 81% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Tags: Too many tags (18 tag instead of maximum 10); only the first 5 tags are used in your directory listing
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === compress-images-with-squeezeimg === )
  • Screenshots: Please add descriptions for these screenshots #1, #1, #10, #11, #12, #13, #14, #15, #16, #17, #18, #19, #2, #2, #20, #3, #3, #4, #4, #5, #5, #6, #6, #7, #7, #8, #9 in compress-images-with-squeezeimg/assets to your readme.txt
The official readme.txt is a good inspiration

compress-images-with-squeezeimg/imagecompresssqueezeimg.php 92% from 13 tests

The entry point to "Compress Images with Squeezeimg (Webp/Jp2/Avif)" version 1.0.7 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("compress-images-with-squeezeimg.php" instead of "imagecompresssqueezeimg.php")

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
Good job! No executable or dangerous file extensions detected3,985 lines of code in 39 files:
LanguageFilesBlank linesComment linesLines of code
PHP305941,2662,737
CSS2908538
JavaScript27830472
PO File1541108
Markdown131093
JSON22036
SVG1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity18.58
▷ Minimum class complexity1.00
▷ Maximum class complexity125.00
Average method complexity3.11
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces11
Interfaces0
Traits0
Classes19
▷ Abstract classes15.26%
▷ Concrete classes1894.74%
▷ Final classes15.56%
Methods161
▷ Static methods53.11%
▷ Public methods14791.30%
▷ Protected methods10.62%
▷ Private methods138.07%
Functions13
▷ Named functions1292.31%
▷ Anonymous functions17.69%
Constants19
▷ Global constants1684.21%
▷ Class constants315.79%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/images/check.png0.48KB0.46KB▼ 3.29%