WebP Express - Version 0.14.4

Version Description

(released: 18 jun 2019)

  • Now bundles with multiple cwebp binaries for linux for systems where 1.0.2 fails.
Download this release

Release Info

Developer rosell.dk
Plugin Icon 128x128 WebP Express
Version 0.14.4
Comparing to
See all releases

Code changes from version 0.14.3 to 0.14.4

README.md CHANGED
@@ -597,12 +597,17 @@ Here are my current plans ahead: 0.15 will probably be a file manager-like inter
597
598
If you wish to affect priorities, it is certainly possible. You can try to argue your case in the forum or you can simply let the money do the talking. By donating as little as a cup of coffee on [ko-fi.com/rosell](https://ko-fi.com/rosell), you can leave a wish. I shall take these wishes into account when prioritizing between new features.
599
600
## Changes in 0.14.2
601
- Fixed problem with older versions of cwebp
602
- Fixed that images was not deleted
603
- Fixed cache problem on options page on systems that disables cache busting (it resulted in "SyntaxError: JSON.parse")
604
605
-
606
## Changes in 0.14.1
607
- A little something
608
597
598
If you wish to affect priorities, it is certainly possible. You can try to argue your case in the forum or you can simply let the money do the talking. By donating as little as a cup of coffee on [ko-fi.com/rosell](https://ko-fi.com/rosell), you can leave a wish. I shall take these wishes into account when prioritizing between new features.
599
600
+ ## Changes in 0.14.4
601
+ - Now bundles with multiple cwebp binaries for linux for systems where 1.0.2 fails.
602
+
603
+ ## Changes in 0.14.3
604
+ - Fixed filename of supplied cwebp for linux (bug was introduced in 0.14.2)
605
+
606
## Changes in 0.14.2
607
- Fixed problem with older versions of cwebp
608
- Fixed that images was not deleted
609
- Fixed cache problem on options page on systems that disables cache busting (it resulted in "SyntaxError: JSON.parse")
610
611
## Changes in 0.14.1
612
- A little something
613
README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://ko-fi.com/rosell
4
Tags: webp, images, performance
5
Requires at least: 4.0
6
Tested up to: 5.2
7
- Stable tag: 0.14.3
8
Requires PHP: 5.6
9
License: GPLv3
10
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -12,7 +12,7 @@ License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP.
13
14
== Description ==
15
-
16
Almost 4 out of 5 mobile users use a browser that is able to display webp images. Yet, on most websites, they are served jpeg images, which are typically double the size of webp images for a given quality. What a waste of bandwidth! This plugin was created to help remedy that situation. With little effort, Wordpress admins can have their site serving autogenerated webp images to browsers that supports it, while still serving jpeg and png files to browsers that does not support webp.
17
18
### The image converter
@@ -605,8 +605,13 @@ Easy enough! - [Go here!](https://ko-fi.com/rosell). Or [here](https://buymeacof
605
606
== Changelog ==
607
608
= 0.14.3 =
609
- *(released: 17 jun 2019)*
610
611
* Fixed filename of supplied cwebp for linux (bug was introduced in 0.14.2)
612
@@ -814,6 +819,9 @@ For older releases, check out changelog.txt
814
815
== Upgrade Notice ==
816
817
= 0.14.3 =
818
Fixed supplied binary for cwebp (linux)
819
4
Tags: webp, images, performance
5
Requires at least: 4.0
6
Tested up to: 5.2
7
+ Stable tag: 0.14.4
8
Requires PHP: 5.6
9
License: GPLv3
10
License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP.
13
14
== Description ==
15
+ [](http://coderisk.com/wp/plugin/webp-express/RIPS-NAA8tMia3z)
16
Almost 4 out of 5 mobile users use a browser that is able to display webp images. Yet, on most websites, they are served jpeg images, which are typically double the size of webp images for a given quality. What a waste of bandwidth! This plugin was created to help remedy that situation. With little effort, Wordpress admins can have their site serving autogenerated webp images to browsers that supports it, while still serving jpeg and png files to browsers that does not support webp.
17
18
### The image converter
605
606
== Changelog ==
607
608
+ = 0.14.4 =
609
+ *(released: 18 jun 2019)*
610
+
611
+ * Now bundles with multiple cwebp binaries for linux for systems where 1.0.2 fails.
612
+
613
= 0.14.3 =
614
+ *(released: 18 jun 2019)*
615
616
* Fixed filename of supplied cwebp for linux (bug was introduced in 0.14.2)
617
819
820
== Upgrade Notice ==
821
822
+ = 0.14.4 =
823
+ Now bundles with multiple cwebp binaries for linux for systems where 1.0.2 fails.
824
+
825
= 0.14.3 =
826
Fixed supplied binary for cwebp (linux)
827
composer.json CHANGED
@@ -4,7 +4,7 @@
4
"type": "project",
5
"license": "MIT",
6
"require": {
7
- "rosell-dk/webp-convert": "^2.0.4",
8
"rosell-dk/webp-convert-cloud-service": "^2.0.0",
9
"rosell-dk/dom-util-for-webp": "^0.3.0"
10
},
4
"type": "project",
5
"license": "MIT",
6
"require": {
7
+ "rosell-dk/webp-convert": "^2.0.5",
8
"rosell-dk/webp-convert-cloud-service": "^2.0.0",
9
"rosell-dk/dom-util-for-webp": "^0.3.0"
10
},
composer.lock CHANGED
@@ -4,7 +4,7 @@
4
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
"This file is @generated automatically"
6
],
7
- "content-hash": "97433d27c25eeb18cddee6770a5ba113",
8
"packages": [
9
{
10
"name": "rosell-dk/dom-util-for-webp",
@@ -118,16 +118,16 @@
118
},
119
{
120
"name": "rosell-dk/webp-convert",
121
- "version": "2.0.4",
122
"source": {
123
"type": "git",
124
"url": "https://github.com/rosell-dk/webp-convert.git",
125
- "reference": "4b1a09667fa1f1e3c543322439f269b5d931d5ee"
126
},
127
"dist": {
128
"type": "zip",
129
- "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/4b1a09667fa1f1e3c543322439f269b5d931d5ee",
130
- "reference": "4b1a09667fa1f1e3c543322439f269b5d931d5ee",
131
"shasum": ""
132
},
133
"require": {
@@ -190,7 +190,7 @@
190
"png",
191
"png2webp"
192
],
193
- "time": "2019-06-18T04:55:53+00:00"
194
},
195
{
196
"name": "rosell-dk/webp-convert-cloud-service",
4
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
"This file is @generated automatically"
6
],
7
+ "content-hash": "e9798456dd33cb07d197bf1d9af46f7e",
8
"packages": [
9
{
10
"name": "rosell-dk/dom-util-for-webp",
118
},
119
{
120
"name": "rosell-dk/webp-convert",
121
+ "version": "2.0.5",
122
"source": {
123
"type": "git",
124
"url": "https://github.com/rosell-dk/webp-convert.git",
125
+ "reference": "5d69bbb048334badffca2983511800604d650da3"
126
},
127
"dist": {
128
"type": "zip",
129
+ "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/5d69bbb048334badffca2983511800604d650da3",
130
+ "reference": "5d69bbb048334badffca2983511800604d650da3",
131
"shasum": ""
132
},
133
"require": {
190
"png",
191
"png2webp"
192
],
193
+ "time": "2019-06-18T12:27:33+00:00"
194
},
195
{
196
"name": "rosell-dk/webp-convert-cloud-service",
lib/classes/ConvertHelperIndependent.php CHANGED
@@ -234,7 +234,7 @@ APACHE
234
235
$text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
236
237
- $text = 'WebP Express 0.14.3. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
238
239
$logFile = self::getLogFilename($source, $logDir);
240
234
235
$text = preg_replace('#' . preg_quote($_SERVER["DOCUMENT_ROOT"]) . '#', '[doc-root]', $text);
236
237
+ $text = 'WebP Express 0.14.4. ' . $msgTop . ', ' . date("Y-m-d H:i:s") . "\n\r\n\r" . $text;
238
239
$logFile = self::getLogFilename($source, $logDir);
240
vendor/composer/installed.json CHANGED
@@ -115,17 +115,17 @@
115
},
116
{
117
"name": "rosell-dk/webp-convert",
118
- "version": "2.0.4",
119
- "version_normalized": "2.0.4.0",
120
"source": {
121
"type": "git",
122
"url": "https://github.com/rosell-dk/webp-convert.git",
123
- "reference": "4b1a09667fa1f1e3c543322439f269b5d931d5ee"
124
},
125
"dist": {
126
"type": "zip",
127
- "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/4b1a09667fa1f1e3c543322439f269b5d931d5ee",
128
- "reference": "4b1a09667fa1f1e3c543322439f269b5d931d5ee",
129
"shasum": ""
130
},
131
"require": {
@@ -143,7 +143,7 @@
143
"ext-vips": "to use Vips extension for converting.",
144
"php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
145
},
146
- "time": "2019-06-18T04:55:53+00:00",
147
"type": "library",
148
"extra": {
149
"scripts-descriptions": {
115
},
116
{
117
"name": "rosell-dk/webp-convert",
118
+ "version": "2.0.5",
119
+ "version_normalized": "2.0.5.0",
120
"source": {
121
"type": "git",
122
"url": "https://github.com/rosell-dk/webp-convert.git",
123
+ "reference": "5d69bbb048334badffca2983511800604d650da3"
124
},
125
"dist": {
126
"type": "zip",
127
+ "url": "https://api.github.com/repos/rosell-dk/webp-convert/zipball/5d69bbb048334badffca2983511800604d650da3",
128
+ "reference": "5d69bbb048334badffca2983511800604d650da3",
129
"shasum": ""
130
},
131
"require": {
143
"ext-vips": "to use Vips extension for converting.",
144
"php-stan/php-stan": "Suggested for dev, in order to analyse code before committing"
145
},
146
+ "time": "2019-06-18T12:27:33+00:00",
147
"type": "library",
148
"extra": {
149
"scripts-descriptions": {
vendor/rosell-dk/webp-convert/src-build/webp-convert.inc CHANGED
@@ -2365,12 +2365,22 @@ class Cwebp extends AbstractConverter
2365
// (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os)
2366
// Got the precompiled binaries here: https://developers.google.com/speed/webp/docs/precompiled
2367
private static $suppliedBinariesInfo = [
2368
- 'WINNT' => [ 'cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873'],
2369
- 'Darwin' => [ 'cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379'],
2370
- 'SunOS' => [ 'cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f'],
2371
- 'FreeBSD' => [ 'cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573'],
2372
- 'Linux' => [ 'cwebp-linux', 'd6142e9da2f1cab541de10a31527c597225fff5644e66e31d62bb391c41bfbf4'] // 1.0.2
2373
-
2374
];
2375
2376
public function checkOperationality()
@@ -2583,7 +2593,7 @@ class Cwebp extends AbstractConverter
2583
/**
2584
* Get path for supplied binary for current OS - and validate hash.
2585
*
2586
- * @return string|false False if something is wrong, otherwise the path.
2587
*/
2588
private function getSuppliedBinaryPathForOS()
2589
{
@@ -2593,43 +2603,62 @@ class Cwebp extends AbstractConverter
2593
$options = $this->options;
2594
if (!isset(self::$suppliedBinariesInfo[PHP_OS])) {
2595
$this->logLn('No we dont - not for that OS');
2596
- return false;
2597
}
2598
$this->logLn('We do.');
2599
2600
- $info = self::$suppliedBinariesInfo[PHP_OS];
2601
2602
- $file = $info[0];
2603
- $hash = $info[1];
2604
2605
- $binaryFile = __DIR__ . '/' . $options['rel-path-to-precompiled-binaries'] . '/' . $file;
2606
2607
- // The file should exist, but may have been removed manually.
2608
- if (!file_exists($binaryFile)) {
2609
- $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
2610
- return false;
2611
- }
2612
2613
- // File exists, now generate its hash
2614
- // hash_file() is normally available, but it is not always
2615
- // - https://stackoverflow.com/questions/17382712/php-5-3-20-undefined-function-hash
2616
- // If available, validate that hash is correct.
2617
2618
- if (function_exists('hash_file')) {
2619
- $binaryHash = hash_file('sha256', $binaryFile);
2620
2621
- if ($binaryHash != $hash) {
2622
- $this->logLn(
2623
- 'Binary checksum of supplied binary is invalid! ' .
2624
- 'Did you transfer with FTP, but not in binary mode? ' .
2625
- 'File:' . $binaryFile . '. ' .
2626
- 'Expected checksum: ' . $hash . '. ' .
2627
- 'Actual checksum:' . $binaryHash . '.',
2628
- 'bold'
2629
- );
2630
}
2631
}
2632
- return $binaryFile;
2633
}
2634
2635
private function discoverBinaries()
@@ -2664,8 +2693,8 @@ class Cwebp extends AbstractConverter
2664
}
2665
// TODO: exec('whereis cwebp');
2666
if ($this->options['try-supplied-binary-for-os']) {
2667
- $suppliedBinary = $this->getSuppliedBinaryPathForOS();
2668
- if ($suppliedBinary !== false) {
2669
$binaries[] = $suppliedBinary;
2670
}
2671
} else {
2365
// (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os)
2366
// Got the precompiled binaries here: https://developers.google.com/speed/webp/docs/precompiled
2367
private static $suppliedBinariesInfo = [
2368
+ 'WINNT' => [['cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873']],
2369
+ 'Darwin' => [['cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379']],
2370
+ 'SunOS' => [['cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f']],
2371
+ 'FreeBSD' => [['cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573']],
2372
+ 'Linux' => [
2373
+ // Dynamically linked executable.
2374
+ // It seems it is slightly faster than the statically linked
2375
+ ['cwebp-linux-1.0.2-shared', 'd6142e9da2f1cab541de10a31527c597225fff5644e66e31d62bb391c41bfbf4'],
2376
+
2377
+ // Statically linked executable
2378
+ // It may be that it on some systems works, where the dynamically linked does not (see #196)
2379
+ ['cwebp-linux-1.0.2-static', 'a67092563d9de0fbced7dde61b521d60d10c0ad613327a42a81845aefa612b29'],
2380
+
2381
+ // Old executable for systems where both of the above fails
2382
+ ['cwebp-linux-0.6.1', '916623e5e9183237c851374d969aebdb96e0edc0692ab7937b95ea67dc3b2568'],
2383
+ ]
2384
];
2385
2386
public function checkOperationality()
2593
/**
2594
* Get path for supplied binary for current OS - and validate hash.
2595
*
2596
+ * @return array Array of supplied binaries (which actually exists, and where hash validates)
2597
*/
2598
private function getSuppliedBinaryPathForOS()
2599
{
2603
$options = $this->options;
2604
if (!isset(self::$suppliedBinariesInfo[PHP_OS])) {
2605
$this->logLn('No we dont - not for that OS');
2606
+ return [];
2607
}
2608
$this->logLn('We do.');
2609
2610
+ $result = [];
2611
+ $files = self::$suppliedBinariesInfo[PHP_OS];
2612
+ if (count($files) > 0) {
2613
+ $this->logLn('We in fact have ' . count($files));
2614
+ }
2615
2616
+ foreach ($files as $i => list($file, $hash)) {
2617
+ //$file = $info[0];
2618
+ //$hash = $info[1];
2619
2620
+ $binaryFile = __DIR__ . '/' . $options['rel-path-to-precompiled-binaries'] . '/' . $file;
2621
2622
+ // Replace "/./" with "/" in path (we could alternatively use realpath)
2623
+ //$binaryFile = preg_replace('#\/\.\/#', '/', $binaryFile);
2624
+ // The file should exist, but may have been removed manually.
2625
+ /*
2626
+ if (!file_exists($binaryFile)) {
2627
+ $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
2628
+ return false;
2629
+ }*/
2630
+
2631
+ $realPathResult = realpath($binaryFile);
2632
+ if ($realPathResult === false) {
2633
+ $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
2634
+ continue;
2635
+ }
2636
+ $binaryFile = $realPathResult;
2637
2638
+ // File exists, now generate its hash
2639
+ // hash_file() is normally available, but it is not always
2640
+ // - https://stackoverflow.com/questions/17382712/php-5-3-20-undefined-function-hash
2641
+ // If available, validate that hash is correct.
2642
2643
+ if (function_exists('hash_file')) {
2644
+ $binaryHash = hash_file('sha256', $binaryFile);
2645
2646
+ if ($binaryHash != $hash) {
2647
+ $this->logLn(
2648
+ 'Binary checksum of supplied binary is invalid! ' .
2649
+ 'Did you transfer with FTP, but not in binary mode? ' .
2650
+ 'File:' . $binaryFile . '. ' .
2651
+ 'Expected checksum: ' . $hash . '. ' .
2652
+ 'Actual checksum:' . $binaryHash . '.',
2653
+ 'bold'
2654
+ );
2655
+ continue;
2656
+ }
2657
}
2658
+ $result[] = $binaryFile;
2659
}
2660
+
2661
+ return $result;
2662
}
2663
2664
private function discoverBinaries()
2693
}
2694
// TODO: exec('whereis cwebp');
2695
if ($this->options['try-supplied-binary-for-os']) {
2696
+ $suppliedBinaries = $this->getSuppliedBinaryPathForOS();
2697
+ foreach ($suppliedBinaries as $suppliedBinary) {
2698
$binaries[] = $suppliedBinary;
2699
}
2700
} else {
vendor/rosell-dk/webp-convert/src-build/webp-on-demand-2.inc CHANGED
@@ -2287,12 +2287,22 @@ class Cwebp extends AbstractConverter
2287
// (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os)
2288
// Got the precompiled binaries here: https://developers.google.com/speed/webp/docs/precompiled
2289
private static $suppliedBinariesInfo = [
2290
- 'WINNT' => [ 'cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873'],
2291
- 'Darwin' => [ 'cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379'],
2292
- 'SunOS' => [ 'cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f'],
2293
- 'FreeBSD' => [ 'cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573'],
2294
- 'Linux' => [ 'cwebp-linux', 'd6142e9da2f1cab541de10a31527c597225fff5644e66e31d62bb391c41bfbf4'] // 1.0.2
2295
-
2296
];
2297
2298
public function checkOperationality()
@@ -2505,7 +2515,7 @@ class Cwebp extends AbstractConverter
2505
/**
2506
* Get path for supplied binary for current OS - and validate hash.
2507
*
2508
- * @return string|false False if something is wrong, otherwise the path.
2509
*/
2510
private function getSuppliedBinaryPathForOS()
2511
{
@@ -2515,43 +2525,62 @@ class Cwebp extends AbstractConverter
2515
$options = $this->options;
2516
if (!isset(self::$suppliedBinariesInfo[PHP_OS])) {
2517
$this->logLn('No we dont - not for that OS');
2518
- return false;
2519
}
2520
$this->logLn('We do.');
2521
2522
- $info = self::$suppliedBinariesInfo[PHP_OS];
2523
2524
- $file = $info[0];
2525
- $hash = $info[1];
2526
2527
- $binaryFile = __DIR__ . '/' . $options['rel-path-to-precompiled-binaries'] . '/' . $file;
2528
2529
- // The file should exist, but may have been removed manually.
2530
- if (!file_exists($binaryFile)) {
2531
- $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
2532
- return false;
2533
- }
2534
2535
- // File exists, now generate its hash
2536
- // hash_file() is normally available, but it is not always
2537
- // - https://stackoverflow.com/questions/17382712/php-5-3-20-undefined-function-hash
2538
- // If available, validate that hash is correct.
2539
2540
- if (function_exists('hash_file')) {
2541
- $binaryHash = hash_file('sha256', $binaryFile);
2542
2543
- if ($binaryHash != $hash) {
2544
- $this->logLn(
2545
- 'Binary checksum of supplied binary is invalid! ' .
2546
- 'Did you transfer with FTP, but not in binary mode? ' .
2547
- 'File:' . $binaryFile . '. ' .
2548
- 'Expected checksum: ' . $hash . '. ' .
2549
- 'Actual checksum:' . $binaryHash . '.',
2550
- 'bold'
2551
- );
2552
}
2553
}
2554
- return $binaryFile;
2555
}
2556
2557
private function discoverBinaries()
@@ -2586,8 +2615,8 @@ class Cwebp extends AbstractConverter
2586
}
2587
// TODO: exec('whereis cwebp');
2588
if ($this->options['try-supplied-binary-for-os']) {
2589
- $suppliedBinary = $this->getSuppliedBinaryPathForOS();
2590
- if ($suppliedBinary !== false) {
2591
$binaries[] = $suppliedBinary;
2592
}
2593
} else {
2287
// (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os)
2288
// Got the precompiled binaries here: https://developers.google.com/speed/webp/docs/precompiled
2289
private static $suppliedBinariesInfo = [
2290
+ 'WINNT' => [['cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873']],
2291
+ 'Darwin' => [['cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379']],
2292
+ 'SunOS' => [['cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f']],
2293
+ 'FreeBSD' => [['cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573']],
2294
+ 'Linux' => [
2295
+ // Dynamically linked executable.
2296
+ // It seems it is slightly faster than the statically linked
2297
+ ['cwebp-linux-1.0.2-shared', 'd6142e9da2f1cab541de10a31527c597225fff5644e66e31d62bb391c41bfbf4'],
2298
+
2299
+ // Statically linked executable
2300
+ // It may be that it on some systems works, where the dynamically linked does not (see #196)
2301
+ ['cwebp-linux-1.0.2-static', 'a67092563d9de0fbced7dde61b521d60d10c0ad613327a42a81845aefa612b29'],
2302
+
2303
+ // Old executable for systems where both of the above fails
2304
+ ['cwebp-linux-0.6.1', '916623e5e9183237c851374d969aebdb96e0edc0692ab7937b95ea67dc3b2568'],
2305
+ ]
2306
];
2307
2308
public function checkOperationality()
2515
/**
2516
* Get path for supplied binary for current OS - and validate hash.
2517
*
2518
+ * @return array Array of supplied binaries (which actually exists, and where hash validates)
2519
*/
2520
private function getSuppliedBinaryPathForOS()
2521
{
2525
$options = $this->options;
2526
if (!isset(self::$suppliedBinariesInfo[PHP_OS])) {
2527
$this->logLn('No we dont - not for that OS');
2528
+ return [];
2529
}
2530
$this->logLn('We do.');
2531
2532
+ $result = [];
2533
+ $files = self::$suppliedBinariesInfo[PHP_OS];
2534
+ if (count($files) > 0) {
2535
+ $this->logLn('We in fact have ' . count($files));
2536
+ }
2537
2538
+ foreach ($files as $i => list($file, $hash)) {
2539
+ //$file = $info[0];
2540
+ //$hash = $info[1];
2541
2542
+ $binaryFile = __DIR__ . '/' . $options['rel-path-to-precompiled-binaries'] . '/' . $file;
2543
2544
+ // Replace "/./" with "/" in path (we could alternatively use realpath)
2545
+ //$binaryFile = preg_replace('#\/\.\/#', '/', $binaryFile);
2546
+ // The file should exist, but may have been removed manually.
2547
+ /*
2548
+ if (!file_exists($binaryFile)) {
2549
+ $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
2550
+ return false;
2551
+ }*/
2552
+
2553
+ $realPathResult = realpath($binaryFile);
2554
+ if ($realPathResult === false) {
2555
+ $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
2556
+ continue;
2557
+ }
2558
+ $binaryFile = $realPathResult;
2559
2560
+ // File exists, now generate its hash
2561
+ // hash_file() is normally available, but it is not always
2562
+ // - https://stackoverflow.com/questions/17382712/php-5-3-20-undefined-function-hash
2563
+ // If available, validate that hash is correct.
2564
2565
+ if (function_exists('hash_file')) {
2566
+ $binaryHash = hash_file('sha256', $binaryFile);
2567
2568
+ if ($binaryHash != $hash) {
2569
+ $this->logLn(
2570
+ 'Binary checksum of supplied binary is invalid! ' .
2571
+ 'Did you transfer with FTP, but not in binary mode? ' .
2572
+ 'File:' . $binaryFile . '. ' .
2573
+ 'Expected checksum: ' . $hash . '. ' .
2574
+ 'Actual checksum:' . $binaryHash . '.',
2575
+ 'bold'
2576
+ );
2577
+ continue;
2578
+ }
2579
}
2580
+ $result[] = $binaryFile;
2581
}
2582
+
2583
+ return $result;
2584
}
2585
2586
private function discoverBinaries()
2615
}
2616
// TODO: exec('whereis cwebp');
2617
if ($this->options['try-supplied-binary-for-os']) {
2618
+ $suppliedBinaries = $this->getSuppliedBinaryPathForOS();
2619
+ foreach ($suppliedBinaries as $suppliedBinary) {
2620
$binaries[] = $suppliedBinary;
2621
}
2622
} else {
vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-linux-0.6.1 ADDED
Binary file
vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/{cwebp-linux → cwebp-linux-1.0.2-shared} RENAMED
File without changes
vendor/rosell-dk/webp-convert/src/Convert/Converters/Binaries/cwebp-linux-1.0.2-static ADDED
Binary file
vendor/rosell-dk/webp-convert/src/Convert/Converters/Cwebp.php CHANGED
@@ -56,12 +56,22 @@ class Cwebp extends AbstractConverter
56
// (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os)
57
// Got the precompiled binaries here: https://developers.google.com/speed/webp/docs/precompiled
58
private static $suppliedBinariesInfo = [
59
- 'WINNT' => [ 'cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873'],
60
- 'Darwin' => [ 'cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379'],
61
- 'SunOS' => [ 'cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f'],
62
- 'FreeBSD' => [ 'cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573'],
63
- 'Linux' => [ 'cwebp-linux', 'd6142e9da2f1cab541de10a31527c597225fff5644e66e31d62bb391c41bfbf4'] // 1.0.2
64
-
65
];
66
67
public function checkOperationality()
@@ -274,7 +284,7 @@ class Cwebp extends AbstractConverter
274
/**
275
* Get path for supplied binary for current OS - and validate hash.
276
*
277
- * @return string|false False if something is wrong, otherwise the path.
278
*/
279
private function getSuppliedBinaryPathForOS()
280
{
@@ -284,43 +294,62 @@ class Cwebp extends AbstractConverter
284
$options = $this->options;
285
if (!isset(self::$suppliedBinariesInfo[PHP_OS])) {
286
$this->logLn('No we dont - not for that OS');
287
- return false;
288
}
289
$this->logLn('We do.');
290
291
- $info = self::$suppliedBinariesInfo[PHP_OS];
292
-
293
- $file = $info[0];
294
- $hash = $info[1];
295
-
296
- $binaryFile = __DIR__ . '/' . $options['rel-path-to-precompiled-binaries'] . '/' . $file;
297
-
298
- // The file should exist, but may have been removed manually.
299
- if (!file_exists($binaryFile)) {
300
- $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
301
- return false;
302
}
303
304
- // File exists, now generate its hash
305
- // hash_file() is normally available, but it is not always
306
- // - https://stackoverflow.com/questions/17382712/php-5-3-20-undefined-function-hash
307
- // If available, validate that hash is correct.
308
309
- if (function_exists('hash_file')) {
310
- $binaryHash = hash_file('sha256', $binaryFile);
311
312
- if ($binaryHash != $hash) {
313
- $this->logLn(
314
- 'Binary checksum of supplied binary is invalid! ' .
315
- 'Did you transfer with FTP, but not in binary mode? ' .
316
- 'File:' . $binaryFile . '. ' .
317
- 'Expected checksum: ' . $hash . '. ' .
318
- 'Actual checksum:' . $binaryHash . '.',
319
- 'bold'
320
- );
321
}
322
}
323
- return $binaryFile;
324
}
325
326
private function discoverBinaries()
@@ -355,8 +384,8 @@ class Cwebp extends AbstractConverter
355
}
356
// TODO: exec('whereis cwebp');
357
if ($this->options['try-supplied-binary-for-os']) {
358
- $suppliedBinary = $this->getSuppliedBinaryPathForOS();
359
- if ($suppliedBinary !== false) {
360
$binaries[] = $suppliedBinary;
361
}
362
} else {
56
// (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os)
57
// Got the precompiled binaries here: https://developers.google.com/speed/webp/docs/precompiled
58
private static $suppliedBinariesInfo = [
59
+ 'WINNT' => [['cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873']],
60
+ 'Darwin' => [['cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379']],
61
+ 'SunOS' => [['cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f']],
62
+ 'FreeBSD' => [['cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573']],
63
+ 'Linux' => [
64
+ // Dynamically linked executable.
65
+ // It seems it is slightly faster than the statically linked
66
+ ['cwebp-linux-1.0.2-shared', 'd6142e9da2f1cab541de10a31527c597225fff5644e66e31d62bb391c41bfbf4'],
67
+
68
+ // Statically linked executable
69
+ // It may be that it on some systems works, where the dynamically linked does not (see #196)
70
+ ['cwebp-linux-1.0.2-static', 'a67092563d9de0fbced7dde61b521d60d10c0ad613327a42a81845aefa612b29'],
71
+
72
+ // Old executable for systems where both of the above fails
73
+ ['cwebp-linux-0.6.1', '916623e5e9183237c851374d969aebdb96e0edc0692ab7937b95ea67dc3b2568'],
74
+ ]
75
];
76
77
public function checkOperationality()
284
/**
285
* Get path for supplied binary for current OS - and validate hash.
286
*
287
+ * @return array Array of supplied binaries (which actually exists, and where hash validates)
288
*/
289
private function getSuppliedBinaryPathForOS()
290
{
294
$options = $this->options;
295
if (!isset(self::$suppliedBinariesInfo[PHP_OS])) {
296
$this->logLn('No we dont - not for that OS');
297
+ return [];
298
}
299
$this->logLn('We do.');
300
301
+ $result = [];
302
+ $files = self::$suppliedBinariesInfo[PHP_OS];
303
+ if (count($files) > 0) {
304
+ $this->logLn('We in fact have ' . count($files));
305
}
306
307
+ foreach ($files as $i => list($file, $hash)) {
308
+ //$file = $info[0];
309
+ //$hash = $info[1];
310
+
311
+ $binaryFile = __DIR__ . '/' . $options['rel-path-to-precompiled-binaries'] . '/' . $file;
312
+
313
+ // Replace "/./" with "/" in path (we could alternatively use realpath)
314
+ //$binaryFile = preg_replace('#\/\.\/#', '/', $binaryFile);
315
+ // The file should exist, but may have been removed manually.
316
+ /*
317
+ if (!file_exists($binaryFile)) {
318
+ $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
319
+ return false;
320
+ }*/
321
+
322
+ $realPathResult = realpath($binaryFile);
323
+ if ($realPathResult === false) {
324
+ $this->logLn('Supplied binary not found! It ought to be here:' . $binaryFile, 'italic');
325
+ continue;
326
+ }
327
+ $binaryFile = $realPathResult;
328
329
+ // File exists, now generate its hash
330
+ // hash_file() is normally available, but it is not always
331
+ // - https://stackoverflow.com/questions/17382712/php-5-3-20-undefined-function-hash
332
+ // If available, validate that hash is correct.
333
334
+ if (function_exists('hash_file')) {
335
+ $binaryHash = hash_file('sha256', $binaryFile);
336
+
337
+ if ($binaryHash != $hash) {
338
+ $this->logLn(
339
+ 'Binary checksum of supplied binary is invalid! ' .
340
+ 'Did you transfer with FTP, but not in binary mode? ' .
341
+ 'File:' . $binaryFile . '. ' .
342
+ 'Expected checksum: ' . $hash . '. ' .
343
+ 'Actual checksum:' . $binaryHash . '.',
344
+ 'bold'
345
+ );
346
+ continue;
347
+ }
348
}
349
+ $result[] = $binaryFile;
350
}
351
+
352
+ return $result;
353
}
354
355
private function discoverBinaries()
384
}
385
// TODO: exec('whereis cwebp');
386
if ($this->options['try-supplied-binary-for-os']) {
387
+ $suppliedBinaries = $this->getSuppliedBinaryPathForOS();
388
+ foreach ($suppliedBinaries as $suppliedBinary) {
389
$binaries[] = $suppliedBinary;
390
}
391
} else {
webp-express.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: WebP Express
4
* Plugin URI: https://github.com/rosell-dk/webp-express
5
* Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
6
- * Version: 0.14.3
7
* Author: Bjørn Rosell
8
* Author URI: https://www.bitwise-it.dk
9
* License: GPL2
3
* Plugin Name: WebP Express
4
* Plugin URI: https://github.com/rosell-dk/webp-express
5
* Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
6
+ * Version: 0.14.4
7
* Author: Bjørn Rosell
8
* Author URI: https://www.bitwise-it.dk
9
* License: GPL2