Imagify Image Optimizer - Version 1.5.4

Version Description

  • Improvement
    • Increase to 4 the number of parallel queries during a bulk optimization
    • Don't display Intercom chat if the user turned off the option in the web app
Download this release

Release Info

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

Code changes from version 1.5.3 to 1.5.4

assets/js/imagify.min.js CHANGED
@@ -2,4 +2,4 @@
2
  * imagify-gulpjs - version 0.0.1 - 2016-04-07
3
  * WP Media <contact@wp-media.me>
4
  */
5
- "use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),ImagifyGulp=function(){function a(b){_classCallCheck(this,a),this.buffer_size=3,this.lib_url=b.lib,this.default_thumb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==",this.images=b.images,this.images_ids=Object.keys(b.images),this.total_images=this.images_ids.length,this.processed_images=0,this.inprocess_images=0,this._before=new Function,this._each=new Function,this._done=new Function,this._error=new Function,this.total_original_size=0,this.total_optimized_size=0,this.total_gain=0,this.total_percent=0,this.global_original_size=0,this.global_optimized_size=0,this.global_gain=0,this.global_percent=0,this.context=b.context||"wp"}return _createClass(a,[{key:"before",value:function(a){return this._before=a,this}},{key:"each",value:function(a){return this._each=a,this}},{key:"done",value:function(a){return this._done=a,this}},{key:"error",value:function(a){return this._error=a,this}},{key:"humanSize",value:function(a){if(0==a)return"0kb";var b=["b","kb","mb"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,c)).toFixed(2)+b[c]}},{key:"run",value:function(){for(var a=this.images_ids.length>this.buffer_size?this.buffer_size:this.images_ids.length,b=0;a>b;b++){var c=this.images_ids.shift();this.process(c)}return this}},{key:"process",value:function(a){this.inprocess_images++;var b={id:a,image_id:parseInt(a.toString().substr(1)),image_src:this.images[a],filename:this.images[a].split("/").pop(),thumbnail:this.default_thumb,error:""};this.createThumb(b)}},{key:"createThumb",value:function(a){var b=this,c=new Image;c.onerror=function(){var c=a;c.id=a.image_id,b._before(c),b.send(a)},c.onload=function(){var d=33,e=33,f=c.width,g=c.height,h=1,i=0,j=0,k=null,l=null;g>f?(h=d/f,j=d,i=g*h):(h=e/g,i=e,j=f*h),k=document.createElement("canvas"),k.width=j,k.height=i,c.width=j,c.height=i,l=k.getContext("2d"),l.drawImage(this,0,0,j,i);try{a.thumbnail=k.toDataURL("image/jpeg")}catch(m){a.thumbnail=b.default_thumb}var n=a;n.id=a.image_id,b._before(n),b.send(a),k=null},c.src=a.image_src}},{key:"send",value:function(a){var b=this,c=new XMLHttpRequest,d=!1,e={},f={filename:a.filename,image:a.image_id,error:""};c.onreadystatechange=function(){if(4===this.readyState){b.processed_images++;try{e=JSON.parse(this.responseText),d=!1}catch(a){f.success=!1,f.error="Unknown error occured",d=!0}if(f.progress=Math.floor(b.processed_images/b.total_images*100),!d){var c=e.data;f.success=e.success,e.success===!0?(b.total_original_size+=c.original_size,b.total_optimized_size+=c.new_size,b.total_gain+=c.original_size-c.new_size,b.total_percent=(b.total_optimized_size/b.total_original_size*100).toFixed(2),b.global_original_size+=c.original_overall_size,b.global_optimized_size+=c.new_overall_size,b.global_gain+=c.overall_saving,b.global_percent=(100-b.global_optimized_size/b.global_optimized_size*100).toFixed(2),f.original_size=c.original_size,f.original_size_human=b.humanSize(c.original_size),f.new_size=c.new_size,f.new_size_human=b.humanSize(c.new_size),f.percent=c.percent,f.thumbnails=c.thumbnails,f.overall_saving=c.overall_saving,f.overall_saving_human=b.humanSize(c.overall_saving),f.original_overall_size=c.original_overall_size,f.original_overall_size_human=b.humanSize(c.original_overall_size)):f.error=c.error}if(b._each(f),b.inprocess_images<b.total_images&&b.process(b.images_ids.shift()),b.processed_images==b.total_images){var g=0;0!=b.global_original_size&&(g=(100-100*(b.global_optimized_size/b.global_original_size)).toFixed(2)),b._done({global_original_size_human:b.humanSize(b.global_original_size),global_gain_human:b.humanSize(b.global_gain),global_percent:g})}}},c.open("POST",this.lib_url,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send("image="+a.image_id+"&context="+this.context)}}]),a}();
2
  * imagify-gulpjs - version 0.0.1 - 2016-04-07
3
  * WP Media <contact@wp-media.me>
4
  */
5
+ "use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),ImagifyGulp=function(){function a(b){_classCallCheck(this,a),this.buffer_size=imagifyBulk.buffer_size,this.lib_url=b.lib,this.default_thumb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAACy0lEQVRIx+1XS1PTUBTuT/MB1NGF3bhyhys3Pv+Ai8pCF6Bb3bsWq8xAh8441I2TSlKwPIKQJsI40IbSV0pJ6qe3OeZ1b9PaYViQyaJzc+757j3nO985TVx5v3o+b+IS6XyQUgtrj/NqWtJmZf3lavnpl53bC2vjRLqRUV4pxqbZcnrBx3F6G2ZzTjFg879IMwWtanV7g56K1Z2RtBGRpj7IWb0a8HhqOz9O2rjHfrOD34GvWcPEruGQkhmlcFgnF7bjABVJmvA4uj4vY2VJr545/yClw/okBywaadF/m63j1gT/sNO5DbXW8t4sLtJzSQtnAme/ys/BrU9FpdIgY2R3MBLidtQ+ZRt2T9qZvQrtf/N9X5BwbEQKmSVIFGZjEGlWNojB93KbCBolDNl49nVPAIYwUs5QGAOQwCtmuuyGG5ExGhZbtM7s+5+3BGC5nyazhB8RElSAePRwRaX1u9nScadfVYjtncV1HtKDlW0KQMqvID4kCAydHST2fgKhu24B7dTaSY4oYBf2MjN44yK9+FZmRnrdCnuhr3jyB7Vr89G8L9f7oU77VSPhp4POjNarzUgv77Z/ERh+R9oUXbqDXFyktFtJ5ag74cU9cBsCwy3DNoht5Fcf0pO8ysuTt27IFzKH/Hm/Qopi5ekP99zzgkU8goF7VN21ThfM9BKHylHEPbzoQ8wUlSGoG1QVnR3Vhppj66hCtgg/Ayr3tdLXCFQ7al4ABr2gAEBHoCbQFDu+RkCvqPVBx5LCZvq2dEDsgELuDqV7rM/SfvmocfNjkYcEdV8Kdcu4Wh6QLzzoPQKtQ9DQvQL9ZYhOiCYteXougo/9UEIv9YHxKK+iZ9qenouE8QIunCMMMzxHYIIomU2ksBOaI5ZHmCO8OavEnI0K2hjmvTnevPe3bjBlTvKvMsoMi4kVAgO/qBXMGvidGu8Me/lf4yIg/QYbLcmjDg4bKwAAAABJRU5ErkJggg==",this.images=b.images,this.images_ids=Object.keys(b.images),this.total_images=this.images_ids.length,this.processed_images=0,this.inprocess_images=0,this._before=new Function,this._each=new Function,this._done=new Function,this._error=new Function,this.total_original_size=0,this.total_optimized_size=0,this.total_gain=0,this.total_percent=0,this.global_original_size=0,this.global_optimized_size=0,this.global_gain=0,this.global_percent=0,this.context=b.context||"wp"}return _createClass(a,[{key:"before",value:function(a){return this._before=a,this}},{key:"each",value:function(a){return this._each=a,this}},{key:"done",value:function(a){return this._done=a,this}},{key:"error",value:function(a){return this._error=a,this}},{key:"humanSize",value:function(a){if(0==a)return"0kb";var b=["b","kb","mb"],c=parseInt(Math.floor(Math.log(a)/Math.log(1024)));return(a/Math.pow(1024,c)).toFixed(2)+b[c]}},{key:"run",value:function(){for(var a=this.images_ids.length>this.buffer_size?this.buffer_size:this.images_ids.length,b=0;a>b;b++){var c=this.images_ids.shift();this.process(c)}return this}},{key:"process",value:function(a){this.inprocess_images++;var b={id:a,image_id:parseInt(a.toString().substr(1)),image_src:this.images[a],filename:this.images[a].split("/").pop(),thumbnail:this.default_thumb,error:""};this.createThumb(b)}},{key:"createThumb",value:function(a){var b=this,c=new Image;c.onerror=function(){var c=a;c.id=a.image_id,b._before(c),b.send(a)},c.onload=function(){var d=33,e=33,f=c.width,g=c.height,h=1,i=0,j=0,k=null,l=null;g>f?(h=d/f,j=d,i=g*h):(h=e/g,i=e,j=f*h),k=document.createElement("canvas"),k.width=j,k.height=i,c.width=j,c.height=i,l=k.getContext("2d"),l.drawImage(this,0,0,j,i);try{a.thumbnail=k.toDataURL("image/jpeg")}catch(m){a.thumbnail=b.default_thumb}var n=a;n.id=a.image_id,b._before(n),b.send(a),k=null},c.src=a.image_src}},{key:"send",value:function(a){var b=this,c=new XMLHttpRequest,d=!1,e={},f={filename:a.filename,image:a.image_id,error:""};c.onreadystatechange=function(){if(4===this.readyState){b.processed_images++;try{e=JSON.parse(this.responseText),d=!1}catch(a){f.success=!1,f.error="Unknown error occured",d=!0}if(f.progress=Math.floor(b.processed_images/b.total_images*100),!d){var c=e.data;f.success=e.success,e.success===!0?(b.total_original_size+=c.original_size,b.total_optimized_size+=c.new_size,b.total_gain+=c.original_size-c.new_size,b.total_percent=(b.total_optimized_size/b.total_original_size*100).toFixed(2),b.global_original_size+=c.original_overall_size,b.global_optimized_size+=c.new_overall_size,b.global_gain+=c.overall_saving,b.global_percent=(100-b.global_optimized_size/b.global_optimized_size*100).toFixed(2),f.original_size=c.original_size,f.original_size_human=b.humanSize(c.original_size),f.new_size=c.new_size,f.new_size_human=b.humanSize(c.new_size),f.percent=c.percent,f.thumbnails=c.thumbnails,f.overall_saving=c.overall_saving,f.overall_saving_human=b.humanSize(c.overall_saving),f.original_overall_size=c.original_overall_size,f.original_overall_size_human=b.humanSize(c.original_overall_size)):f.error=c.error}if(b._each(f),b.inprocess_images<b.total_images&&b.process(b.images_ids.shift()),b.processed_images==b.total_images){var g=0;0!=b.global_original_size&&(g=(100-100*(b.global_optimized_size/b.global_original_size)).toFixed(2)),b._done({global_original_size_human:b.humanSize(b.global_original_size),global_gain_human:b.humanSize(b.global_gain),global_percent:g})}}},c.open("POST",this.lib_url,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send("image="+a.image_id+"&context="+this.context)}}]),a}();
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.3
7
  Author: WP Media
8
  Author URI: http://wp-media.me
9
  Licence: GPLv2
@@ -17,7 +17,7 @@ Copyright 2015 WP Media
17
  defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
18
 
19
  // Imagify defines
20
- define( 'IMAGIFY_VERSION' , '1.5.3' );
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.4
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.4' );
21
  define( 'IMAGIFY_SLUG' , 'imagify' );
22
  define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
23
  define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php CHANGED
@@ -32,12 +32,14 @@ function _imagify_ngg_admin_print_styles() {
32
  */
33
  if ( isset( $current_screen ) && false !== strpos( $current_screen->base, '_page_imagify-ngg-bulk-optimization' ) ) {
34
  wp_enqueue_script( 'heartbeat' );
35
-
36
- $user = get_imagify_user();
37
  $bulk_data = get_imagify_localize_script_translations( 'bulk' );
38
  $bulk_data['heartbeat_id'] = 'update_ngg_bulk_data';
39
  $bulk_data['ajax_action'] = 'imagify_ngg_get_unoptimized_attachment_ids';
40
  $bulk_data['ajax_context'] = 'NGG';
 
 
 
41
 
42
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
43
  wp_enqueue_script( 'imagify-js-chart' );
32
  */
33
  if ( isset( $current_screen ) && false !== strpos( $current_screen->base, '_page_imagify-ngg-bulk-optimization' ) ) {
34
  wp_enqueue_script( 'heartbeat' );
35
+
 
36
  $bulk_data = get_imagify_localize_script_translations( 'bulk' );
37
  $bulk_data['heartbeat_id'] = 'update_ngg_bulk_data';
38
  $bulk_data['ajax_action'] = 'imagify_ngg_get_unoptimized_attachment_ids';
39
  $bulk_data['ajax_context'] = 'NGG';
40
+
41
+ /** This filter is documented in inc/admin/enqueue.php */
42
+ $bulk_data['buffer_size'] = apply_filters( 'imagify_bulk_buffer_size', 4 );
43
 
44
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
45
  wp_enqueue_script( 'imagify-js-chart' );
inc/admin/enqueue.php CHANGED
@@ -37,7 +37,7 @@ function _imagify_admin_print_styles() {
37
  wp_register_script(
38
  'imagify-js-async',
39
  IMAGIFY_ASSETS_JS_URL . 'imagify.min.js',
40
- array(),
41
  IMAGIFY_VERSION,
42
  true
43
  );
@@ -169,7 +169,14 @@ function _imagify_admin_print_styles() {
169
  $bulk_data['heartbeat_id'] = 'update_bulk_data';
170
  $bulk_data['ajax_action'] = 'imagify_get_unoptimized_attachment_ids';
171
  $bulk_data['ajax_context'] = 'wp';
172
-
 
 
 
 
 
 
 
173
  wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
174
  wp_enqueue_script( 'imagify-js-chart' );
175
  wp_enqueue_script( 'imagify-js-async' );
@@ -186,8 +193,8 @@ add_action( 'admin_footer-media_page_imagify-bulk-optimization', '_imagify_admin
186
  add_action( 'admin_footer-settings_page_imagify', '_imagify_admin_print_intercom' );
187
  function _imagify_admin_print_intercom() {
188
  $user = get_imagify_user();
189
-
190
- if ( ! imagify_valid_key() || empty( $user->is_intercom ) ) {
191
  return;
192
  }
193
  ?>
37
  wp_register_script(
38
  'imagify-js-async',
39
  IMAGIFY_ASSETS_JS_URL . 'imagify.min.js',
40
+ array( 'imagify-js-bulk' ),
41
  IMAGIFY_VERSION,
42
  true
43
  );
169
  $bulk_data['heartbeat_id'] = 'update_bulk_data';
170
  $bulk_data['ajax_action'] = 'imagify_get_unoptimized_attachment_ids';
171
  $bulk_data['ajax_context'] = 'wp';
172
+
173
+ /**
174
+ * Filter the number of parallel queries during the Bulk Optimization
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' );
182
  wp_enqueue_script( 'imagify-js-async' );
193
  add_action( 'admin_footer-settings_page_imagify', '_imagify_admin_print_intercom' );
194
  function _imagify_admin_print_intercom() {
195
  $user = get_imagify_user();
196
+
197
+ if ( ! imagify_valid_key() || empty( $user->is_intercom ) || false === $user->display_support ) {
198
  return;
199
  }
200
  ?>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.5.1
6
- Stable tag: 1.5.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -98,7 +98,7 @@ Absolutely. You are limited to a quota of 25 MB of images per month with a free
98
 
99
  You can use the plugin on as many sites as you wish. The only limit is the optimization quota of your account.
100
 
101
- = I used Kraken, Optimus, EWWW or WP Smush, will Imagify further optimize my images? =
102
 
103
  Absolutely. Most of the time, Imagify will still be able to optimize your images even if you have already compressed them with another tool.
104
 
@@ -118,7 +118,7 @@ No. Imagify automatically replaces the images with an optimized image. The backu
118
 
119
  Yes. By activating the backup option in the plugin, you can re-optimize each image with a different compression level.
120
 
121
- = If I use Imagify, do I need to continue optimizing and resizinf my images with Photoshop? =
122
 
123
  Do not waste your time resizing and optimizing your images in Photoshop. Imagify takes care of everything!
124
 
@@ -136,6 +136,11 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
136
 
137
  == Changelog ==
138
 
 
 
 
 
 
139
  = 1.5.3 =
140
  * Regression Fix
141
  * Display the Original Filesize in "View Details" section
2
  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.5.2
6
+ Stable tag: 1.5.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
98
 
99
  You can use the plugin on as many sites as you wish. The only limit is the optimization quota of your account.
100
 
101
+ = I used Kraken, Shortpixel, Optimus, EWWW or WP Smush, will Imagify further optimize my images? =
102
 
103
  Absolutely. Most of the time, Imagify will still be able to optimize your images even if you have already compressed them with another tool.
104
 
118
 
119
  Yes. By activating the backup option in the plugin, you can re-optimize each image with a different compression level.
120
 
121
+ = If I use Imagify, do I need to continue optimizing and resizing my images with Photoshop? =
122
 
123
  Do not waste your time resizing and optimizing your images in Photoshop. Imagify takes care of everything!
124
 
136
 
137
  == Changelog ==
138
 
139
+ = 1.5.4 =
140
+ * Improvement
141
+ * Increase to 4 the number of parallel queries during a bulk optimization
142
+ * Don't display Intercom chat if the user turned off the option in the web app
143
+
144
  = 1.5.3 =
145
  * Regression Fix
146
  * Display the Original Filesize in "View Details" section