reSmush.it Image Optimizer - Version 0.4.9

Version Description

  • Compatibility with WP 6.1.0
  • Compatible with PHP 8.1.X
  • Fixed issue on Undefined array key "file" in .../resmushit.php on line 114
Download this release

Release Info

Developer resmushit
Plugin Icon 128x128 reSmush.it Image Optimizer
Version 0.4.9
Comparing to
See all releases

Code changes from version 0.4.8 to 0.4.9

Files changed (3) hide show
  1. readme.txt +8 -3
  2. resmushit.php +19 -4
  3. resmushit.settings.php +1 -1
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: resmushit
3
  Tags: image, optimizer, image optimization, resmush.it, smush, jpg, png, gif, optimization, compression, Compress, Images, Pictures, Reduce Image Size, Smush, Smush.it
4
  Requires at least: 4.0.0
5
- Tested up to: 6.0.3
6
- Stable tag: 0.4.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -14,7 +14,7 @@ The FREE Image Optimizer which will compress your pictures and improve your SEO
14
  reSmush.it Image Optimizer allow to use **free Image optimization** based on [reSmush.it API](http://www.resmush.it/ "Image Optimization API, developped by Charles Bourgeaux"). reSmush.it provides image size reduction based on several advanced algorithms. The API accept JPG, PNG and GIF files up to **5MB**.
15
 
16
  This plugin includes a bulk operation to optimize all your pictures in 2 clicks ! Change your image optimization level to fit your needs !
17
- This service is used by more than **400,000** websites on different CMS (Wordpress, Drupal, Joomla, Magento, Prestashop...).
18
 
19
  The plugin includes an option to exclude some pictures of the optimizer.
20
 
@@ -75,6 +75,11 @@ Yes ! Absolutely free, the only restriction is to send images below 5MB.
75
  == Changelog ==
76
 
77
 
 
 
 
 
 
78
  = 0.4.8 =
79
  * Incorrect library imported (fix `PHP Fatal error: Uncaught Error: Undefined constant “SECURE_AUTH_COOKIE” in /wp-includes/pluggable.php:923`)
80
 
2
  Contributors: resmushit
3
  Tags: image, optimizer, image optimization, resmush.it, smush, jpg, png, gif, optimization, compression, Compress, Images, Pictures, Reduce Image Size, Smush, Smush.it
4
  Requires at least: 4.0.0
5
+ Tested up to: 6.1.0
6
+ Stable tag: 0.4.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
14
  reSmush.it Image Optimizer allow to use **free Image optimization** based on [reSmush.it API](http://www.resmush.it/ "Image Optimization API, developped by Charles Bourgeaux"). reSmush.it provides image size reduction based on several advanced algorithms. The API accept JPG, PNG and GIF files up to **5MB**.
15
 
16
  This plugin includes a bulk operation to optimize all your pictures in 2 clicks ! Change your image optimization level to fit your needs !
17
+ This service is used by more than **400,000*php* websites on different CMS (Wordpress, Drupal, Joomla, Magento, Prestashop...).
18
 
19
  The plugin includes an option to exclude some pictures of the optimizer.
20
 
75
  == Changelog ==
76
 
77
 
78
+ = 0.4.9 =
79
+ * Compatibility with WP 6.1.0
80
+ * Compatible with PHP 8.1.X
81
+ * Fixed issue on Undefined array key "file" in .../resmushit.php on line 114
82
+
83
  = 0.4.8 =
84
  * Incorrect library imported (fix `PHP Fatal error: Uncaught Error: Undefined constant “SECURE_AUTH_COOKIE” in /wp-includes/pluggable.php:923`)
85
 
resmushit.php CHANGED
@@ -10,8 +10,8 @@
10
  * Plugin Name: reSmush.it Image Optimizer
11
  * Plugin URI: https://wordpress.org/plugins/resmushit-image-optimizer/
12
  * Description: Image Optimization API. Provides image size optimization
13
- * Version: 0.4.8
14
- * Timestamp: 2022.10.26
15
  * Author: reSmush.it
16
  * Author URI: https://resmush.it
17
  * Author: Charles Bourgeaux
@@ -107,8 +107,17 @@ function resmushit_process_images($attachments, $force_keep_original = TRUE) {
107
  }
108
 
109
  $fileInfo = pathinfo(get_attached_file( $attachment_id ));
 
 
 
 
110
  $basepath = $fileInfo['dirname'] . '/';
111
  $extension = isset($fileInfo['extension']) ? $fileInfo['extension'] : NULL;
 
 
 
 
 
112
  $basefile = basename($attachments[ 'file' ]);
113
 
114
  // Optimize only pictures/files accepted by the API
@@ -118,8 +127,13 @@ function resmushit_process_images($attachments, $force_keep_original = TRUE) {
118
 
119
  $statistics[] = reSmushit::optimize($basepath . $basefile, $force_keep_original );
120
 
121
- foreach($attachments['sizes'] as $image_style)
 
 
 
 
122
  $statistics[] = reSmushit::optimize($basepath . $image_style['file'], FALSE );
 
123
 
124
  $count = 0;
125
  foreach($statistics as $stat){
@@ -127,8 +141,9 @@ function resmushit_process_images($attachments, $force_keep_original = TRUE) {
127
  $cumulated_original_sizes += $stat->src_size;
128
  $cumulated_optimized_sizes += $stat->dest_size;
129
  $count++;
130
- } else
131
  $error = TRUE;
 
132
  }
133
  if(!$error) {
134
  $optimizations_successful_count = get_option('resmushit_total_optimized');
10
  * Plugin Name: reSmush.it Image Optimizer
11
  * Plugin URI: https://wordpress.org/plugins/resmushit-image-optimizer/
12
  * Description: Image Optimization API. Provides image size optimization
13
+ * Version: 0.4.9
14
+ * Timestamp: 2022.11.02
15
  * Author: reSmush.it
16
  * Author URI: https://resmush.it
17
  * Author: Charles Bourgeaux
107
  }
108
 
109
  $fileInfo = pathinfo(get_attached_file( $attachment_id ));
110
+ if(!isset($fileInfo['dirname'])) {
111
+ rlog("Error! Incorrect file provided." . print_r($fileInfo), 'WARNING');
112
+ return $attachments;
113
+ }
114
  $basepath = $fileInfo['dirname'] . '/';
115
  $extension = isset($fileInfo['extension']) ? $fileInfo['extension'] : NULL;
116
+
117
+ if(!isset($attachments[ 'file' ])) {
118
+ rlog("Error! Incorrect attachment." . print_r($attachments), 'WARNING');
119
+ return $attachments;
120
+ }
121
  $basefile = basename($attachments[ 'file' ]);
122
 
123
  // Optimize only pictures/files accepted by the API
127
 
128
  $statistics[] = reSmushit::optimize($basepath . $basefile, $force_keep_original );
129
 
130
+ if(!isset($attachments[ 'sizes' ])) {
131
+ rlog("Error! Unable to find attachments sizes." . print_r($attachments), 'WARNING');
132
+ return $attachments;
133
+ }
134
+ foreach($attachments['sizes'] as $image_style) {
135
  $statistics[] = reSmushit::optimize($basepath . $image_style['file'], FALSE );
136
+ }
137
 
138
  $count = 0;
139
  foreach($statistics as $stat){
141
  $cumulated_original_sizes += $stat->src_size;
142
  $cumulated_optimized_sizes += $stat->dest_size;
143
  $count++;
144
+ } else {
145
  $error = TRUE;
146
+ }
147
  }
148
  if(!$error) {
149
  $optimizations_successful_count = get_option('resmushit_total_optimized');
resmushit.settings.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  define('RESMUSHIT_ENDPOINT', 'http://api.resmush.it/');
4
- define('RESMUSHIT_VERSION', '0.4.8');
5
  define('RESMUSHIT_DEFAULT_QLTY', '92');
6
  define('RESMUSHIT_TIMEOUT', '10');
7
  define('RESMUSHIT_LOGS_PATH', 'resmushit.log');
1
  <?php
2
 
3
  define('RESMUSHIT_ENDPOINT', 'http://api.resmush.it/');
4
+ define('RESMUSHIT_VERSION', '0.4.9');
5
  define('RESMUSHIT_DEFAULT_QLTY', '92');
6
  define('RESMUSHIT_TIMEOUT', '10');
7
  define('RESMUSHIT_LOGS_PATH', 'resmushit.log');