79% tiny-compress-images

Code Review | TinyPNG - JPEG, PNG & WebP image compression

WordPress plugin TinyPNG - JPEG, PNG & WebP image compression scored79%from 54 tests.

About plugin

  • Plugin page: tiny-compress-images
  • Plugin version: 3.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-6.4
  • WordPress version: 6.3.1
  • First release: Feb 12, 2015
  • Latest release: Nov 8, 2023
  • Number of updates: 174
  • Update frequency: every 18.3 days
  • Top authors: TinyPNG (97.13%)Tinify (3.45%)

Code review

54 tests

User reviews

150 reviews

Install metrics

200,000+ active /3,266,521 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲0.56MB] [CPU: ▼1.86ms] Passed 4 tests

A check of server-side resources used by TinyPNG - JPEG, PNG & WebP image compression
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.01 ▲0.5540.10 ▼3.95
Dashboard /wp-admin3.89 ▲0.5450.00 ▼11.40
Posts /wp-admin/edit.php3.99 ▲0.6351.84 ▲4.14
Add New Post /wp-admin/post-new.php6.47 ▲0.59102.35 ▲3.79
Media Library /wp-admin/upload.php3.80 ▲0.5740.08 ▲7.66
Bulk Optimization /wp-admin/upload.php?page=tiny-bulk-optimization3.7435.27
TinyPNG - JPEG, PNG & WebP image compression /wp-admin/options-general.php?page=tinify3.7739.11

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 66 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
db_upgraded
theysaidso_admin_options
tinypng_compression_timing
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by TinyPNG - JPEG, PNG & WebP image compression
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,943 ▲19614.28 ▼0.071.60 ▼0.1637.72 ▼7.98
Dashboard /wp-admin2,348 ▲1685.76 ▲0.1198.76 ▼0.2047.08 ▲4.11
Posts /wp-admin/edit.php2,130 ▲272.03 ▲0.0541.67 ▲6.5141.67 ▲5.91
Add New Post /wp-admin/post-new.php1,548 ▲2223.60 ▲0.14585.90 ▼54.6067.72 ▲11.11
Media Library /wp-admin/upload.php1,438 ▲384.45 ▲0.25104.74 ▲3.4143.21 ▲0.62
Bulk Optimization /wp-admin/upload.php?page=tiny-bulk-optimization1,0712.2627.6350.31
TinyPNG - JPEG, PNG & WebP image compression /wp-admin/options-general.php?page=tinify1,0722.2729.9431.64

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin does not fully uninstall, leaving 7 options in the database
    • theysaidso_admin_options
    • tinypng_compression_timing
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/upload.php?page=tiny-bulk-optimization
    • > Notice in wp-content/plugins/tiny-compress-images/src/class-tiny-bulk-optimization.php+41
    Trying to access array offset on value of type bool

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 51× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to get property 'ok' of non-object in wp-content/plugins/tiny-compress-images/src/views/account-status-connected.php on line 2
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/tiny-compress-images/src/views/bulk-optimization.php on line 9
    • > PHP Notice
      Undefined variable: status in wp-content/plugins/tiny-compress-images/src/views/account-status-connected.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'Tiny_WP_Base' not found in wp-content/plugins/tiny-compress-images/src/class-tiny-settings.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/tiny-compress-images/src/views/bulk-optimization.php:36
    • > PHP Notice
      Undefined variable: admin_colors in wp-content/plugins/tiny-compress-images/src/views/bulk-optimization.php on line 24
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/tiny-compress-images/src/views/bulk-optimization.php on line 21
    • > PHP Notice
      Undefined variable: admin_colors in wp-content/plugins/tiny-compress-images/src/views/bulk-optimization.php on line 9
    • > PHP Notice
      Undefined variable: tiny_image in wp-content/plugins/tiny-compress-images/src/views/compress-details-processing.php on line 1
    • > PHP Notice
      Undefined variable: admin_colors in wp-content/plugins/tiny-compress-images/src/views/bulk-optimization.php on line 25

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 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
5 plugin tags: compression, performance, image size, page speed, compress images

tiny-compress-images/tiny-compress-images.php Passed 13 tests

The main PHP file in "TinyPNG - JPEG, PNG & WebP image compression" ver. 3.4.3 adds more information about the plugin and also serves as the entry point for this plugin
91 characters long description:
Speed up your website. Optimize your JPEG, PNG, and WebP images automatically with TinyPNG.

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 plugin5,774 lines of code in 50 files:
LanguageFilesBlank linesComment linesLines of code
PHP336273754,075
CSS41644813
JavaScript3769593
YAML100124
Bourne Again Shell623094
JSON10039
XML12023
Perl12013

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity19.00
▷ Minimum class complexity1.00
▷ Maximum class complexity111.00
Average method complexity2.59
▷ Minimum method complexity1.00
▷ Maximum method complexity29.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes24
▷ Abstract classes28.33%
▷ Concrete classes2291.67%
▷ Final classes00.00%
Methods280
▷ Static methods5118.21%
▷ Public methods22078.57%
▷ Protected methods238.21%
▷ Private methods3713.21%
Functions16
▷ Named functions1487.50%
▷ Anonymous functions212.50%
Constants22
▷ Global constants14.55%
▷ Class constants2195.45%
▷ Public constants21100.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
6 compressed PNG files occupy 0.32MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
src/images/grass.png22.27KB22.90KB0.00%
src/images/panda-laying.png70.10KB73.47KB0.00%
src/images/panda-waiting.png81.14KB84.69KB0.00%
src/images/cloud.png51.39KB56.66KB0.00%
src/images/grass-ie8.png42.35KB15.78KB▼ 62.74%