84% image-sizes

Code Review | ThumbPress - Stop Generating Unnecessary Thumbnails

WordPress plugin ThumbPress - Stop Generating Unnecessary Thumbnails scored84%from 54 tests.

About plugin

  • Plugin page: image-sizes
  • Plugin version: 4.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2-6.3
  • WordPress version: 6.3.1
  • First release: Aug 2, 2016
  • Latest release: Aug 15, 2023
  • Number of updates: 86
  • Update frequency: every 29.9 days
  • Top authors: mukto90 (72.09%)codexpert (29.07%)

Code review

54 tests

User reviews

75 reviews

Install metrics

30,000+ active /426,598 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.73MB] [CPU: ▲1.60ms] Passed 4 tests

A check of server-side resources used by ThumbPress - Stop Generating Unnecessary Thumbnails
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.83 ▲0.3742.48 ▲0.05
Dashboard /wp-admin4.16 ▲0.8654.21 ▲4.97
Posts /wp-admin/edit.php4.25 ▲0.8956.74 ▲4.43
Add New Post /wp-admin/post-new.php6.74 ▲0.85106.33 ▼3.05
Media Library /wp-admin/upload.php4.06 ▲0.8348.96 ▲10.96

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 74 new files
Database: no new tables, 10 new options
New WordPress options
_image-sizes
widget_recent-posts
pl-survey_image-sizes-activated
can_compress_scripts
image-sizes_db-version
image-sizes_install_time
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by ThumbPress - Stop Generating Unnecessary Thumbnails
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,937 ▲20214.53 ▲0.121.65 ▼0.2939.71 ▼6.62
Dashboard /wp-admin2,441 ▲2536.16 ▲0.26121.00 ▲16.4783.84 ▲39.68
Posts /wp-admin/edit.php2,173 ▲842.50 ▲0.4845.93 ▲4.6941.52 ▲6.82
Add New Post /wp-admin/post-new.php1,573 ▲3117.59 ▼0.64622.32 ▲1.0635.01 ▼13.71
Media Library /wp-admin/upload.php1,462 ▲745.09 ▲0.93108.15 ▲7.0388.96 ▲45.99

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin does not fully uninstall, leaving 8 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • image-sizes_db-version
    • _image-sizes
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 11× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/plugin.php' (include_path='.:/usr/share/php') in wp-content/plugins/image-sizes/inc/functions.php on line 2
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/image-sizes/inc/functions.php on line 2
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/image-sizes/inc/functions.php on line 2
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/image-sizes/views/settings/disable-sizes.php on line 10
    • > PHP Fatal error
      Uncaught Error: Class 'Codexpert\\ThumbPress\\Helper' not found in wp-content/plugins/image-sizes/views/settings/disable-sizes.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/image-sizes/views/settings/regenerate-thumbnails.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'Codexpert\\Plugin\\Base' not found in wp-content/plugins/image-sizes/app/Settings.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Codexpert\\ThumbPress\\Helper' not found in wp-content/plugins/image-sizes/views/wizard/disable-thumbnails.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function update_option() in wp-content/plugins/image-sizes/views/wizard/welcome.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_plugins() in wp-content/plugins/image-sizes/views/wizard/complete.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
9 plugin tags: thumbnails, duplicate image, prevent duplicate image, image copy, multiple image creation...

image-sizes/image-sizes.php 85% from 13 tests

The main PHP file in "ThumbPress - Stop Generating Unnecessary Thumbnails" ver. 4.1 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("5.0" instead of "6.2")
  • Domain Path: The domain path is invalid: folder "/languages" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin5,621 lines of code in 68 files:
LanguageFilesBlank linesComment linesLines of code
PHP458871,1483,466
CSS1019191,620
JavaScript7413381
JSON400152
Markdown2002

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity22.62
▷ Minimum class complexity1.00
▷ Maximum class complexity228.00
Average method complexity3.65
▷ Minimum method complexity1.00
▷ Maximum method complexity40.00
Code structure
Namespaces6
Interfaces0
Traits0
Classes26
▷ Abstract classes27.69%
▷ Concrete classes2492.31%
▷ Final classes14.17%
Methods214
▷ Static methods2913.55%
▷ Public methods20394.86%
▷ Protected methods20.93%
▷ Private methods94.21%
Functions8
▷ Named functions112.50%
▷ Anonymous functions787.50%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/icon.png1.54KB1.04KB▼ 32.13%
assets/img/arrow.png0.23KB0.25KB0.00%
vendor/codexpert/plugin/src/assets/img/checked.png18.81KB9.90KB▼ 47.36%
vendor/codexpert/plugin/src/assets/img/survey.png7.31KB3.08KB▼ 57.88%