Imagify Image Optimizer - Version 1.5.10

Version Description

  • Improvement
    • Set to 1 the Bulk buffer size when there are more than 10 thumbnails to avoid "Unkown error" on the Bulk Optimization
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Imagify Image Optimizer
Version 1.5.10
Comparing to
See all releases

Code changes from version 1.5.9 to 1.5.10

imagify.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Imagify
4
  Plugin URI: https://wordpress.org/plugins/imagify/
5
  Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwith using Imagify, the new most advanced image optimization tool.
6
- Version: 1.5.9
7
  Author: WP Media
8
  Author URI: http://wp-media.me
9
  Licence: GPLv2
@@ -17,7 +17,7 @@ Copyright 2016 WP Media
17
  defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
18
 
19
  // Imagify defines
20
- define( 'IMAGIFY_VERSION' , '1.5.9' );
21
  define( 'IMAGIFY_SLUG' , 'imagify' );
22
  define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
23
  define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
3
  Plugin Name: Imagify
4
  Plugin URI: https://wordpress.org/plugins/imagify/
5
  Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwith using Imagify, the new most advanced image optimization tool.
6
+ Version: 1.5.10
7
  Author: WP Media
8
  Author URI: http://wp-media.me
9
  Licence: GPLv2
17
  defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
18
 
19
  // Imagify defines
20
+ define( 'IMAGIFY_VERSION' , '1.5.10' );
21
  define( 'IMAGIFY_SLUG' , 'imagify' );
22
  define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
23
  define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
inc/admin/enqueue.php CHANGED
@@ -175,7 +175,7 @@ function _imagify_admin_print_styles() {
175
  *
176
  * @since 1.5.4
177
  */
178
- $bulk_data['buffer_size'] = apply_filters( 'imagify_bulk_buffer_size', 4 );
179
 
180
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
181
  wp_enqueue_script( 'imagify-js-chart' );
175
  *
176
  * @since 1.5.4
177
  */
178
+ $bulk_data['buffer_size'] = apply_filters( 'imagify_bulk_buffer_size', get_imagify_bulk_buffer_size() );
179
 
180
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
181
  wp_enqueue_script( 'imagify-js-chart' );
inc/admin/ui/options.php CHANGED
@@ -240,31 +240,8 @@ function _imagify_display_options_page() {
240
  <br>
241
 
242
  <?php
243
- $sizes = array();
244
- $is_wp44 = version_compare( $wp_version, '4.4-beta3' ) >= 0;
245
- $all_intermediate_image_sizes = get_intermediate_image_sizes();
246
- $intermediate_image_sizes = apply_filters( 'image_size_names_choose', $all_intermediate_image_sizes );
247
- $all_intermediate_image_sizes = array_combine( $all_intermediate_image_sizes, $all_intermediate_image_sizes );
248
- $intermediate_image_sizes = array_merge( $all_intermediate_image_sizes, $intermediate_image_sizes );
249
- $wp_image_sizes = $is_wp44 ? array( 'thumbnail', 'medium', 'medium_large', 'large' ) : array( 'thumbnail', 'medium', 'large' );
250
-
251
- // Create the full array with sizes and crop info
252
- foreach ( $intermediate_image_sizes as $size => $size_name ) {
253
- if ( in_array( $size, $wp_image_sizes ) && ! is_int( $size ) ) {
254
- $sizes[ $size ] = array(
255
- 'width' => get_option( $size . '_size_w' ),
256
- 'height' => get_option( $size . '_size_h' ),
257
- 'name' => $size_name,
258
- );
259
- } elseif ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
260
- $sizes[ $size ] = array(
261
- 'width' => $_wp_additional_image_sizes[ $size ]['width'],
262
- 'height' => $_wp_additional_image_sizes[ $size ]['height'],
263
- 'name' => $size_name,
264
- );
265
- }
266
- }
267
-
268
  foreach( $sizes as $size_key => $size_data ) {
269
  $label = esc_html( stripslashes( $size_data['name'] ) );
270
  $label = sprintf( '%s - %d &times; %d', $label, $size_data['width'], $size_data['height'] );
240
  <br>
241
 
242
  <?php
243
+ $sizes = get_imagify_thumbnail_sizes();
244
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  foreach( $sizes as $size_key => $size_data ) {
246
  $label = esc_html( stripslashes( $size_data['name'] ) );
247
  $label = sprintf( '%s - %d &times; %d', $label, $size_data['width'], $size_data['height'] );
inc/functions/admin.php CHANGED
@@ -161,4 +161,30 @@ function imagify_query_results_combine( $keys, $values ) {
161
  }
162
 
163
  return $result;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
161
  }
162
 
163
  return $result;
164
+ }
165
+
166
+ /**
167
+ * Get the default Bulk Optimization buffer size.
168
+ *
169
+ * @since 1.5.10
170
+ * @author Jonathan Buttigieg
171
+ *
172
+ * @return int The buffer size
173
+ */
174
+ function get_imagify_bulk_buffer_size() {
175
+ $sizes = count( get_imagify_thumbnail_sizes() );
176
+
177
+ switch ( true ) {
178
+ case ( $sizes >= 10 ) :
179
+ return 1;
180
+ break;
181
+ case ( $sizes >= 8 ) :
182
+ return 2;
183
+ break;
184
+ case ( $sizes >= 6 ) :
185
+ return 3;
186
+ break;
187
+ default:
188
+ return 4;
189
+ }
190
  }
inc/functions/attachments.php CHANGED
@@ -91,4 +91,43 @@ function get_imagify_attachment_url( $filename ) {
91
  }
92
 
93
  return $url;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
91
  }
92
 
93
  return $url;
94
+ }
95
+
96
+ /*
97
+ * Get size information for all currently-registered thumbnail sizes.
98
+ *
99
+ * @since 1.5.10
100
+ * @author Jonathan Buttigieg
101
+ *
102
+ * @return array Data for all currently-registered thumbnail sizes.
103
+ */
104
+ function get_imagify_thumbnail_sizes() {
105
+ global $_wp_additional_image_sizes;
106
+
107
+ $sizes = array();
108
+ $is_wp44 = version_compare( $wp_version, '4.4-beta3' ) >= 0;
109
+ $all_intermediate_image_sizes = get_intermediate_image_sizes();
110
+ $intermediate_image_sizes = apply_filters( 'image_size_names_choose', $all_intermediate_image_sizes );
111
+ $all_intermediate_image_sizes = array_combine( $all_intermediate_image_sizes, $all_intermediate_image_sizes );
112
+ $intermediate_image_sizes = array_merge( $all_intermediate_image_sizes, $intermediate_image_sizes );
113
+ $wp_image_sizes = $is_wp44 ? array( 'thumbnail', 'medium', 'medium_large', 'large' ) : array( 'thumbnail', 'medium', 'large' );
114
+
115
+ // Create the full array with sizes and crop info
116
+ foreach ( $intermediate_image_sizes as $size => $size_name ) {
117
+ if ( in_array( $size, $wp_image_sizes ) && ! is_int( $size ) ) {
118
+ $sizes[ $size ] = array(
119
+ 'width' => get_option( $size . '_size_w' ),
120
+ 'height' => get_option( $size . '_size_h' ),
121
+ 'name' => $size_name,
122
+ );
123
+ } elseif ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
124
+ $sizes[ $size ] = array(
125
+ 'width' => $_wp_additional_image_sizes[ $size ]['width'],
126
+ 'height' => $_wp_additional_image_sizes[ $size ]['height'],
127
+ 'name' => $size_name,
128
+ );
129
+ }
130
+ }
131
+
132
+ return $sizes;
133
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wp_media
3
  Tags: compress image, images, performance, optimization, photos, upload, resize, gif, png, jpg, reduce image size, retina
4
  Requires at least: 3.7.0
5
  Tested up to: 4.6
6
- Stable tag: 1.5.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -135,6 +135,10 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
135
  3. Media Page
136
 
137
  == Changelog ==
 
 
 
 
138
  = 1.5.9 =
139
  * Bug fix
140
  * Don't delete the thumbnail when the maximum file size is set to one of the thumbnail size
3
  Tags: compress image, images, performance, optimization, photos, upload, resize, gif, png, jpg, reduce image size, retina
4
  Requires at least: 3.7.0
5
  Tested up to: 4.6
6
+ Stable tag: 1.5.10
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
135
  3. Media Page
136
 
137
  == Changelog ==
138
+ = 1.5.10 =
139
+ * Improvement
140
+ * Set to 1 the Bulk buffer size when there are more than 10 thumbnails to avoid "Unkown error" on the Bulk Optimization
141
+
142
  = 1.5.9 =
143
  * Bug fix
144
  * Don't delete the thumbnail when the maximum file size is set to one of the thumbnail size