94% convert-image-to-media

Code Review | Convert images to media

WordPress plugin Convert images to media scored 94% from 54 tests.

About plugin

  • Plugin page: convert-image-to-...
  • Plugin version: 0.4.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.7.0
  • WordPress version: 5.8.1
  • First release: Nov 2, 2013
  • Latest release: Nov 6, 2013
  • Number of updates: 9
  • Update frequency: every 0.7 days
  • Top authors: Amras (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 900 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼168.16ms] Passed 4 tests

Analyzing server-side resources used by Convert images to media
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.0040.25 ▲8.39
Dashboard /wp-admin3.06 ▲0.0148.82 ▲1.77
Posts /wp-admin/edit.php3.11 ▲0.0146.20 ▼1.25
Add New Post /wp-admin/post-new.php5.42 ▼0.0190.09 ▼673.36
Media Library /wp-admin/upload.php3.01 ▲0.0033.00 ▲0.21
CITM /wp-admin/tools.php?page=citm2.9827.04

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 3 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Convert images to media
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,708 ▲11215.89 ▼0.0411.12 ▲0.6549.10 ▲4.08
Dashboard /wp-admin2,975 ▲445.92 ▼0.25143.25 ▼20.20114.49 ▲3.60
Posts /wp-admin/edit.php2,744 ▲52.70 ▼0.0267.20 ▼6.78100.27 ▲13.76
Add New Post /wp-admin/post-new.php1,503 ▼11218.54 ▼2.97396.09 ▲69.89108.04 ▲6.11
Media Library /wp-admin/upload.php1,812 ▲25.03 ▼0.01164.47 ▲23.45118.53 ▼2.10
CITM /wp-admin/tools.php?page=citm1,1082.0966.5870.30

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
This plugin's uninstaller ran successfully

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 everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/convert-image-to-media/convert-image-to-media.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Screenshots: Add an image for screenshot #1 (The plugin showing images to convert.)
The official readme.txt is a good inspiration

convert-image-to-media/convert-image-to-media.php Passed 13 tests

The main PHP script in "Convert images to media" version 0.4.5 is automatically included on every request by WordPress
87 characters long description:
Looks in wp-content/uploads folder, for image files and convert them to wordpress media

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin147 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP13029147

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity17.00
▷ Minimum class complexity17.00
▷ Maximum class complexity17.00
Average method complexity5.00
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
1 PNG file occupies 0.15MB with 0.09MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png156.90KB61.88KB▼ 60.56%