10% crop-and-resize-images

Code Review | Crop and Resize Images

WordPress plugin Crop and Resize Images scored10%from 54 tests.

About plugin

  • Plugin page: crop-and-resize-i...
  • Plugin version: 1.2.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.3
  • WordPress version: 6.3.1
  • First release: Sep 10, 2015
  • Latest release: Oct 22, 2015
  • Number of updates: 8
  • Update frequency: every 5.3 days
  • Top authors: bo.lipai (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /5,783 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/crop-and-resize-images/includes/library.php+10
    Methods with the same name as their class will not be constructors in a future version of PHP; stringProcess has a deprecated constructor

Server metrics [RAM: ▼1.74MB] [CPU: ▼53.01ms] Passed 4 tests

Analyzing server-side resources used by Crop and Resize Images
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.25 ▼1.224.84 ▼36.58
Dashboard /wp-admin2.27 ▼1.045.93 ▼47.05
Posts /wp-admin/edit.php2.27 ▼1.096.66 ▼43.83
Add New Post /wp-admin/post-new.php2.27 ▼3.626.13 ▼84.58
Media Library /wp-admin/upload.php2.27 ▼0.966.02 ▼30.15

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 18 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Crop and Resize Images
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,819 ▲5814.25 ▼0.122.12 ▲0.5939.64 ▼17.29
Dashboard /wp-admin2,200 ▲235.56 ▼0.0294.72 ▲6.2342.75 ▲0.45
Posts /wp-admin/edit.php2,284 ▲1843.67 ▲1.68101.55 ▲61.2636.54 ▼2.91
Add New Post /wp-admin/post-new.php1,553 ▲2518.47 ▼4.58620.81 ▼70.6843.43 ▼10.19
Media Library /wp-admin/upload.php1,418 ▲184.20 ▲0.0085.85 ▼21.4545.01 ▼3.63

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/crop-and-resize-images/includes/library.php+10
    Methods with the same name as their class will not be constructors in a future version of PHP; stringProcess has a deprecated constructor
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
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 take a closer look at the following
  • 19× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: orig_img_data in wp-content/plugins/crop-and-resize-images/templates/scale-original-image.php on line 17
    • > PHP Notice
      Undefined variable: orig_img_data in wp-content/plugins/crop-and-resize-images/templates/scale-original-image.php on line 17
    • > PHP Notice
      Undefined variable: res in wp-content/plugins/crop-and-resize-images/templates/uie-get-editor.php on line 52
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/crop-and-resize-images/templates/uie-get-editor.php on line 30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/crop-and-resize-images/templates/scale-original-image.php:19
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/crop-and-resize-images/templates/scale-original-image.php on line 17
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/crop-and-resize-images/templates/uie-get-editor.php on line 7
    • > PHP Notice
      Trying to get property 'img_size' of non-object in wp-content/plugins/crop-and-resize-images/templates/uie-get-editor.php on line 52
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/crop-and-resize-images/templates/uie-get-editor.php on line 8
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/crop-and-resize-images/templates/uie-get-editor.php on line 29

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
8 plugin tags: resize, resize image, crop image, crop, picture...

crop-and-resize-images/wp-crop-and-resize.php 92% from 13 tests

The primary PHP file in "Crop and Resize Images" version 1.2.4 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("crop-and-resize-images.php" instead of "wp-crop-and-resize.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin1,638 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP4311151737
JavaScript418638723
CSS6218178

PHP code Passed 2 tests

This is a short overview 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.19
Average class complexity27.50
▷ Minimum class complexity14.00
▷ Maximum class complexity41.00
Average method complexity2.66
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods32
▷ Static methods1959.38%
▷ Public methods32100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/uploader-icons.png1.52KB2.04KB0.00%
img/dw.png0.59KB0.24KB▼ 58.75%