Kraken.io Image Optimizer - Version 2.6.1

Version Description

  • Bug fixes related to new features
Download this release

Release Info

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

Code changes from version 2.6.0 to 2.6.1

Files changed (2) hide show
  1. kraken.php +37 -3
  2. readme.txt +4 -1
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: 2.6.0
25
- * Stable Tag: 2.6.0
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
@@ -67,9 +67,19 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
67
  $this->kraken_settings["optimize_main_image"] = 1;
68
  }
69
 
 
 
 
 
 
70
  add_action( 'admin_menu', array( &$this, 'kraken_menu' ) );
71
  }
72
 
 
 
 
 
 
73
  function isApiActive() {
74
  $settings = $this->kraken_settings;
75
  $api_key = isset( $settings['api_key'] ) ? $settings['api_key'] : '';
@@ -1129,7 +1139,7 @@ EOD;
1129
  if ( $settings['preserve_meta_profile'] ) {
1130
  $preserve_meta_arr[] = 'profile';
1131
  }
1132
- if ( $settings['chroma'] !== '4:2:0' ) {
1133
  $params['sampling_scheme'] = $settings['chroma'];
1134
  }
1135
 
@@ -1196,6 +1206,30 @@ EOD;
1196
  }
1197
  }
1198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1199
  // when resizing has taken place via API, update the post metadata accordingly
1200
  if ( !empty( $kraken_meta['kraked_width'] ) && !empty( $kraken_meta['kraked_height'] ) ) {
1201
  $image_data['width'] = $kraken_meta['kraked_width'];
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: 2.6.1
25
+ * Stable Tag: 2.6.1
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
67
  $this->kraken_settings["optimize_main_image"] = 1;
68
  }
69
 
70
+ // in case settings were not resaved after update
71
+ if ( !isset( $this->kraken_settings["chroma"] ) ) {
72
+ $this->kraken_settings["chroma"] = '4:2:0';
73
+ }
74
+
75
  add_action( 'admin_menu', array( &$this, 'kraken_menu' ) );
76
  }
77
 
78
+ function preg_array_key_exists( $pattern, $array ) {
79
+ $keys = array_keys( $array );
80
+ return (int) preg_grep( $pattern,$keys );
81
+ }
82
+
83
  function isApiActive() {
84
  $settings = $this->kraken_settings;
85
  $api_key = isset( $settings['api_key'] ) ? $settings['api_key'] : '';
1139
  if ( $settings['preserve_meta_profile'] ) {
1140
  $preserve_meta_arr[] = 'profile';
1141
  }
1142
+ if ( $settings['chroma'] ) {
1143
  $params['sampling_scheme'] = $settings['chroma'];
1144
  }
1145
 
1206
  }
1207
  }
1208
 
1209
+ if ( !$this->preg_array_key_exists( '/^include_size_/', $this->kraken_settings ) ) {
1210
+
1211
+ global $_wp_additional_image_sizes;
1212
+ $sizes = array();
1213
+
1214
+ foreach ( get_intermediate_image_sizes() as $_size ) {
1215
+ if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
1216
+ $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
1217
+ $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
1218
+ $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
1219
+ } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1220
+ $sizes[ $_size ] = array(
1221
+ 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
1222
+ 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
1223
+ 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
1224
+ );
1225
+ }
1226
+ }
1227
+ $sizes = array_keys( $sizes );
1228
+ foreach ($sizes as $size) {
1229
+ $this->kraken_settings['include_size_' . $size] = 1;
1230
+ }
1231
+ }
1232
+
1233
  // when resizing has taken place via API, update the post metadata accordingly
1234
  if ( !empty( $kraken_meta['kraked_width'] ) && !empty( $kraken_meta['kraked_height'] ) ) {
1235
  $image_data['width'] = $kraken_meta['kraked_width'];
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: anigif, compress image, exif, image optimizer, image resize, jpg, media, O
5
  Requires at least: 3.0.1
6
  Tested up to: 4.6
7
  Donate link: https://kraken.io
8
- Stable tag: 2.6.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
 
@@ -114,6 +114,9 @@ Kraken.io's service emphasizes finding the precise balance between image quality
114
 
115
  == Changelog ==
116
 
 
 
 
117
  = 2.6.0 =
118
  * Added ability to choose which post sizes get optimized (defaults to all)
119
  * Added ability to change the chroma subsampling scheme for JPEG images (defaults to 4:2:0)
5
  Requires at least: 3.0.1
6
  Tested up to: 4.6
7
  Donate link: https://kraken.io
8
+ Stable tag: 2.6.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
 
114
 
115
  == Changelog ==
116
 
117
+ = 2.6.1 =
118
+ * Bug fixes related to new features
119
+
120
  = 2.6.0 =
121
  * Added ability to choose which post sizes get optimized (defaults to all)
122
  * Added ability to change the chroma subsampling scheme for JPEG images (defaults to 4:2:0)