Compress JPEG & PNG images - Version 3.4.1

Version Description

  • Fixed a bug that sometimes prevented failing requests to the Tinify servers from being retried.
Download this release

Release Info

Developer TinyPNG
Plugin Icon 128x128 Compress JPEG & PNG images
Version 3.4.1
Comparing to
See all releases

Code changes from version 3.4 to 3.4.1

composer.lock CHANGED
@@ -1599,12 +1599,12 @@
1599
  "source": {
1600
  "type": "git",
1601
  "url": "https://github.com/tinify/tinify-php.git",
1602
- "reference": "cd15c07fa56ac71cf66d6b4720ab6a6d6493c940"
1603
  },
1604
  "dist": {
1605
  "type": "zip",
1606
- "url": "https://api.github.com/repos/tinify/tinify-php/zipball/cd15c07fa56ac71cf66d6b4720ab6a6d6493c940",
1607
- "reference": "cd15c07fa56ac71cf66d6b4720ab6a6d6493c940",
1608
  "shasum": ""
1609
  },
1610
  "require": {
@@ -1651,7 +1651,7 @@
1651
  "source": "https://github.com/tinify/tinify-php/tree/create-key",
1652
  "issues": "https://github.com/tinify/tinify-php/issues"
1653
  },
1654
- "time": "2018-11-07T11:13:32+00:00"
1655
  },
1656
  {
1657
  "name": "wp-coding-standards/wpcs",
@@ -1705,5 +1705,5 @@
1705
  "php": ">=5.3.0"
1706
  },
1707
  "platform-dev": [],
1708
- "plugin-api-version": "2.1.0"
1709
  }
1599
  "source": {
1600
  "type": "git",
1601
  "url": "https://github.com/tinify/tinify-php.git",
1602
+ "reference": "58652f928c14647a8bd4e7dc1e732f6a589afcdb"
1603
  },
1604
  "dist": {
1605
  "type": "zip",
1606
+ "url": "https://api.github.com/repos/tinify/tinify-php/zipball/58652f928c14647a8bd4e7dc1e732f6a589afcdb",
1607
+ "reference": "58652f928c14647a8bd4e7dc1e732f6a589afcdb",
1608
  "shasum": ""
1609
  },
1610
  "require": {
1651
  "source": "https://github.com/tinify/tinify-php/tree/create-key",
1652
  "issues": "https://github.com/tinify/tinify-php/issues"
1653
  },
1654
+ "time": "2022-09-01T10:29:52+00:00"
1655
  },
1656
  {
1657
  "name": "wp-coding-standards/wpcs",
1705
  "php": ">=5.3.0"
1706
  },
1707
  "platform-dev": [],
1708
+ "plugin-api-version": "2.3.0"
1709
  }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: TinyPNG
3
  Donate link: https://tinypng.com/
4
  Tags: compress images, compression, image size, page speed, performance
5
- Requires at least: 3.4
6
- Tested up to: 6.0.1
7
- Stable tag: 3.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -131,6 +131,9 @@ A: Yes! After installing the plugin, go to *Media > Bulk Optimization*, and clic
131
  A: You can upgrade to a paid account by adding your *Payment details* on your [account dashboard](https://tinypng.com/dashboard/api). Additional compressions above 500 will then be charged at the end of each month as a one-time fee.
132
 
133
  == Changelog ==
 
 
 
134
  = 3.4 =
135
  * Correct filesize metadata retrieval for compressed images in WordPress 6.
136
  * Updated WordPress compatibility.
2
  Contributors: TinyPNG
3
  Donate link: https://tinypng.com/
4
  Tags: compress images, compression, image size, page speed, performance
5
+ Requires at least: 3.4.1
6
+ Tested up to: 6.0.2
7
+ Stable tag: 3.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
131
  A: You can upgrade to a paid account by adding your *Payment details* on your [account dashboard](https://tinypng.com/dashboard/api). Additional compressions above 500 will then be charged at the end of each month as a one-time fee.
132
 
133
  == Changelog ==
134
+ = 3.4.1 =
135
+ * Fixed a bug that sometimes prevented failing requests to the Tinify servers from being retried.
136
+
137
  = 3.4 =
138
  * Correct filesize metadata retrieval for compressed images in WordPress 6.
139
  * Updated WordPress compatibility.
src/class-tiny-plugin.php CHANGED
@@ -18,7 +18,7 @@
18
  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
  */
20
  class Tiny_Plugin extends Tiny_WP_Base {
21
- const VERSION = '3.4';
22
  const MEDIA_COLUMN = self::NAME;
23
  const DATETIME_FORMAT = 'Y-m-d G:i:s';
24
 
18
  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
  */
20
  class Tiny_Plugin extends Tiny_WP_Base {
21
+ const VERSION = '3.4.1';
22
  const MEDIA_COLUMN = self::NAME;
23
  const DATETIME_FORMAT = 'Y-m-d G:i:s';
24
 
src/vendor/tinify/Tinify/Client.php CHANGED
@@ -112,7 +112,7 @@ class Client {
112
  curl_close($request);
113
 
114
  $headers = self::parseHeaders(substr($response, 0, $headerSize));
115
- $body = substr($response, $headerSize);
116
 
117
  if (isset($headers["compression-count"])) {
118
  Tinify::setCompressionCount(intval($headers["compression-count"]));
@@ -144,8 +144,8 @@ class Client {
144
 
145
  if ($isJson || $isError) {
146
  /* Parse JSON bodies, always interpret errors as JSON. */
147
- $body = json_decode($body);
148
- if (!$body) {
149
  $message = sprintf("Error while parsing response: %s (#%d)",
150
  PHP_VERSION_ID >= 50500 ? json_last_error_msg() : "Error",
151
  json_last_error());
@@ -160,11 +160,11 @@ class Client {
160
  if ($status == 404) {
161
  throw Exception::create(null, null, $status);
162
  } else {
163
- throw Exception::create($body->message, $body->error, $status);
164
  }
165
  }
166
 
167
- return (object) array("body" => $body, "headers" => $headers);
168
  } else {
169
  $message = sprintf("%s (#%d)", curl_error($request), curl_errno($request));
170
  curl_close($request);
112
  curl_close($request);
113
 
114
  $headers = self::parseHeaders(substr($response, 0, $headerSize));
115
+ $responseBody = substr($response, $headerSize);
116
 
117
  if (isset($headers["compression-count"])) {
118
  Tinify::setCompressionCount(intval($headers["compression-count"]));
144
 
145
  if ($isJson || $isError) {
146
  /* Parse JSON bodies, always interpret errors as JSON. */
147
+ $responseBody = json_decode($responseBody);
148
+ if (!$responseBody) {
149
  $message = sprintf("Error while parsing response: %s (#%d)",
150
  PHP_VERSION_ID >= 50500 ? json_last_error_msg() : "Error",
151
  json_last_error());
160
  if ($status == 404) {
161
  throw Exception::create(null, null, $status);
162
  } else {
163
+ throw Exception::create($responseBody->message, $responseBody->error, $status);
164
  }
165
  }
166
 
167
+ return (object) array("body" => $responseBody, "headers" => $headers);
168
  } else {
169
  $message = sprintf("%s (#%d)", curl_error($request), curl_errno($request));
170
  curl_close($request);
tiny-compress-images.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: TinyPNG - JPEG, PNG & WebP image compression
4
  * Description: Speed up your website. Optimize your JPEG, PNG, and WebP images automatically with TinyPNG.
5
- * Version: 3.4
6
  * Author: TinyPNG
7
  * Author URI: https://tinypng.com
8
  * Text Domain: tiny-compress-images
2
  /**
3
  * Plugin Name: TinyPNG - JPEG, PNG & WebP image compression
4
  * Description: Speed up your website. Optimize your JPEG, PNG, and WebP images automatically with TinyPNG.
5
+ * Version: 3.4.1
6
  * Author: TinyPNG
7
  * Author URI: https://tinypng.com
8
  * Text Domain: tiny-compress-images