Kraken.io Image Optimizer - Version 1.0.5.4

Version Description

  • More reliable handling of image fetching and overwriting.
Download this release

Release Info

Developer karim79
Plugin Icon 128x128 Kraken.io Image Optimizer
Version 1.0.5.4
Comparing to
See all releases

Code changes from version 1.0.5.3 to 1.0.5.4

Files changed (2) hide show
  1. kraken.php +23 -9
  2. readme.txt +5 -2
kraken.php CHANGED
@@ -21,8 +21,8 @@
21
  * Plugin URI: http://wordpress.org/plugins/kraken-image-optimizer/
22
  * Description: This plugin allows you to optimize your WordPress images through the Kraken API, the world's most advanced image optimization solution.
23
  * Author: Karim Salman
24
- * Version: 1.0.5.3
25
- * Stable Tag: 1.0.5.3
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
@@ -445,13 +445,27 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
445
 
446
  function replace_image( $image_path, $kraked_url ) {
447
  $rv = false;
448
- $ch = curl_init( $kraked_url );
449
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
450
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
451
- curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
452
- $result = curl_exec( $ch );
453
- $rv = file_put_contents( $image_path, $result );
454
- return $rv !== false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  }
456
 
457
  function optimize_image( $image_path, $type ) {
21
  * Plugin URI: http://wordpress.org/plugins/kraken-image-optimizer/
22
  * Description: This plugin allows you to optimize your WordPress images through the Kraken API, the world's most advanced image optimization solution.
23
  * Author: Karim Salman
24
+ * Version: 1.0.5.4
25
+ * Stable Tag: 1.0.5.4
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
445
 
446
  function replace_image( $image_path, $kraked_url ) {
447
  $rv = false;
448
+ $fp = fopen($image_path, 'w+');
449
+ $ch = curl_init();
450
+ $headers = [];
451
+ $headers[] = "Connection: keep-alive";
452
+ $headers[] = "Keep-Alive: 300";
453
+ curl_setopt($ch, CURLOPT_URL, $kraked_url);
454
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
455
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
456
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
457
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
458
+ curl_setopt($ch, CURLOPT_AUTOREFERER, false);
459
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
460
+ curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
461
+ curl_setopt($ch, CURLOPT_FAILONERROR, true);
462
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
463
+ curl_setopt($ch, CURLOPT_TIMEOUT, 120);
464
+ curl_setopt($ch, CURLOPT_FILE, $fp);
465
+ $rv = curl_exec($ch) !== false;
466
+ curl_close($ch);
467
+ fclose($fp);
468
+ return $rv;
469
  }
470
 
471
  function optimize_image( $image_path, $type ) {
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Kraken Image Optimizer ===
2
  Contributors: karim79
3
- Tags: Image Optimizer, Optimize, Images, Media, Performance, SEO, smushit, smush.it, compress, kraken-image-optimizer, tinypng, jpegmini, ewww, pagespeed, pagespeed insights, sitespeed
4
  Requires at least: 3.0.1
5
  Tested up to: 4.1
6
  Donate link: https://kraken.io
7
- Stable tag: 1.0.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
@@ -94,6 +94,9 @@ You will need to switch the Media Library from the Thumbnail view to the List vi
94
 
95
  == Changelog ==
96
 
 
 
 
97
  = 1.0.5.3 =
98
  * Fixed broken spinner by updating the URL to our new CDN.
99
  * Added link to WP-CLI tools to readme.
1
  === Kraken Image Optimizer ===
2
  Contributors: karim79
3
+ Tags: Image Optimizer, Image Optimiser, Optimize, Images, Media, Performance, SEO, faster loading times, smushit, smush.it, compress, kraken-image-optimizer, tinypng, jpegmini, ewww, pagespeed, pagespeed insights, sitespeed
4
  Requires at least: 3.0.1
5
  Tested up to: 4.1
6
  Donate link: https://kraken.io
7
+ Stable tag: 1.0.5.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
94
 
95
  == Changelog ==
96
 
97
+ = 1.0.5.4 =
98
+ * More reliable handling of image fetching and overwriting.
99
+
100
  = 1.0.5.3 =
101
  * Fixed broken spinner by updating the URL to our new CDN.
102
  * Added link to WP-CLI tools to readme.