Converter for Media – Optimize images | Convert WebP & AVIF - Version 1.0.9

Version Description

(2020-01-03) = * [Added] Limit of maximum image resolution limit using GD library

Download this release

Release Info

Developer mateuszgbiorczyk
Plugin Icon 128x128 Converter for Media – Optimize images | Convert WebP & AVIF
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.0.8 to 1.0.9

app/Convert/Gd.php CHANGED
@@ -104,12 +104,15 @@
104
  try {
105
  $directory = new Directory();
106
  $output = $directory->getPath($path, true);
 
107
  if (!$output) {
108
  throw new \Exception(sprintf('An error occurred creating destination directory for "%s" file.', $path));
109
  } else if (!function_exists('imagewebp')) {
110
  throw new \Exception(sprintf('Server configuration: "%s" function is not available.', 'imagewebp'));
 
 
111
  } else if (!$success = imagewebp($image, $output, $quality)) {
112
- throw new \Exception('Error occurred while converting image.');
113
  }
114
 
115
  return [
104
  try {
105
  $directory = new Directory();
106
  $output = $directory->getPath($path, true);
107
+
108
  if (!$output) {
109
  throw new \Exception(sprintf('An error occurred creating destination directory for "%s" file.', $path));
110
  } else if (!function_exists('imagewebp')) {
111
  throw new \Exception(sprintf('Server configuration: "%s" function is not available.', 'imagewebp'));
112
+ } else if ((imagesx($image) > 8192) || (imagesy($image) > 8192)) {
113
+ throw new \Exception(sprintf('Image is larger than maximum 8K resolution: "%s".', $path));
114
  } else if (!$success = imagewebp($image, $output, $quality)) {
115
+ throw new \Exception(sprintf('Error occurred while converting image: "%s".', $path));
116
  }
117
 
118
  return [
app/Convert/Imagick.php CHANGED
@@ -78,7 +78,7 @@
78
  $image->setImageCompressionQuality($quality);
79
  $blob = $image->getImageBlob();
80
 
81
- $success = file_put_contents($output,$blob);
82
  if (!$success) {
83
  throw new \Exception('Error occurred while converting image.');
84
  }
78
  $image->setImageCompressionQuality($quality);
79
  $blob = $image->getImageBlob();
80
 
81
+ $success = file_put_contents($output, $blob);
82
  if (!$success) {
83
  throw new \Exception('Error occurred while converting image.');
84
  }
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === WebP Converter for Media ===
2
  Contributors: mateuszgbiorczyk
3
- Donate link: https://www.paypal.me/mateuszgbiorczyk/
4
  Tags: webp, images, performance, compress, optimize
5
  Requires at least: 5.0
6
  Tested up to: 5.3
@@ -103,6 +103,14 @@ It uses the WordPress REST API by downloading addresses of all images and conver
103
 
104
  This process may take few or more than ten minutes depending on the number of files.
105
 
 
 
 
 
 
 
 
 
106
  = Where are the converted images stored? =
107
 
108
  All WebP images are stored in the `/wp-content/uploads-webpc/` directory. Inside the directory there is the same structure as in the original `uploads` directory. The files have original extensions in the name along with the new `.webp`.
@@ -144,6 +152,8 @@ When you have installed plugin and converted all images, follow these steps:
144
  7. In addition, you can check weight of website before and after using plugin. The difference will be huge!
145
  8. More information: [here](https://gbiorczyk.pl/webp-converter/check-devtools.png)
146
 
 
 
147
  = Can I enable browser caching for WebP images? =
148
 
149
  Yes of course. The plugin allows this by using the module `mod_expires`. Thanks to this, we can even speed up page loading time for returning users because they do not need to re-download files from the server.
@@ -261,6 +271,9 @@ This is all very important to us and allows us to do even better things for you!
261
 
262
  == Changelog ==
263
 
 
 
 
264
  = 1.0.8 (2019-12-19) =
265
  * `[Fixed]` File deletion for custom paths with converted WebP files
266
  * `[Changed]` Rules management in .htaccess file when activating/deactivating plugin
1
  === WebP Converter for Media ===
2
  Contributors: mateuszgbiorczyk
3
+ Donate link: https://ko-fi.com/gbiorczyk/
4
  Tags: webp, images, performance, compress, optimize
5
  Requires at least: 5.0
6
  Tested up to: 5.3
103
 
104
  This process may take few or more than ten minutes depending on the number of files.
105
 
106
+ = What are the restrictions? =
107
+
108
+ The size of the image is a limited. Its resolution cannot be bigger than `8192 x 8192px`. This is due to the limitations of the PHP library.
109
+
110
+ Please remember that **Safari and Internet Explorer do not support the WebP format**. Therefore, using these browsers you will receive original images.
111
+
112
+ You can find more about WebP support by browsers [here](https://caniuse.com/#feat=webp).
113
+
114
  = Where are the converted images stored? =
115
 
116
  All WebP images are stored in the `/wp-content/uploads-webpc/` directory. Inside the directory there is the same structure as in the original `uploads` directory. The files have original extensions in the name along with the new `.webp`.
152
  7. In addition, you can check weight of website before and after using plugin. The difference will be huge!
153
  8. More information: [here](https://gbiorczyk.pl/webp-converter/check-devtools.png)
154
 
155
+ Please remember that if the converted image in WebP format is larger than the original, the browser will use the original file. Therefore, you can also see files other than WebP on the list.
156
+
157
  = Can I enable browser caching for WebP images? =
158
 
159
  Yes of course. The plugin allows this by using the module `mod_expires`. Thanks to this, we can even speed up page loading time for returning users because they do not need to re-download files from the server.
271
 
272
  == Changelog ==
273
 
274
+ = 1.0.9 (2020-01-03) =
275
+ * `[Added]` Limit of maximum image resolution limit using `GD` library
276
+
277
  = 1.0.8 (2019-12-19) =
278
  * `[Fixed]` File deletion for custom paths with converted WebP files
279
  * `[Changed]` Rules management in .htaccess file when activating/deactivating plugin
webp-converter-for-media.php CHANGED
@@ -3,13 +3,13 @@
3
  /*
4
  Plugin Name: WebP Converter for Media
5
  Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
6
- Version: 1.0.8
7
  Author: Mateusz Gbiorczyk
8
  Author URI: https://gbiorczyk.pl/
9
  Text Domain: webp-converter
10
  */
11
 
12
- define('WEBPC_VERSION', '1.0.8');
13
  define('WEBPC_FILE', __FILE__);
14
  define('WEBPC_NAME', plugin_basename(__FILE__));
15
  define('WEBPC_PATH', plugin_dir_path(__FILE__));
3
  /*
4
  Plugin Name: WebP Converter for Media
5
  Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
6
+ Version: 1.0.9
7
  Author: Mateusz Gbiorczyk
8
  Author URI: https://gbiorczyk.pl/
9
  Text Domain: webp-converter
10
  */
11
 
12
+ define('WEBPC_VERSION', '1.0.9');
13
  define('WEBPC_FILE', __FILE__);
14
  define('WEBPC_NAME', plugin_basename(__FILE__));
15
  define('WEBPC_PATH', plugin_dir_path(__FILE__));