Imsanity - Version 2.3.9

Version Description

  • fixed: PNG to JPG filled transparency with black instead of white
  • fixed: auto-rotation causes incorrect scaling
  • fixed: results box stops scrolling at line 28
  • added: pre-emptive checks on file parameter to prevent read errors with getimagesize()
Download this release

Release Info

Developer nosilver4u
Plugin Icon 128x128 Imsanity
Version 2.3.9
Comparing to
See all releases

Code changes from version 2.3.8 to 2.3.9

Files changed (5) hide show
  1. imsanity.php +38 -29
  2. libs/utils.php +55 -12
  3. readme.txt +7 -3
  4. scripts/imsanity.js +2 -3
  5. settings.php +1 -1
imsanity.php CHANGED
@@ -4,13 +4,13 @@ Plugin Name: Imsanity
4
  Plugin URI: https://wordpress.org/plugins/imsanity/
5
  Description: Imsanity stops insanely huge image uploads
6
  Author: Shane Bishop
7
- Version: 2.3.8
8
  Author URI: https://ewww.io/
9
  Text Domain: imsanity
10
  License: GPLv3
11
  */
12
 
13
- define( 'IMSANITY_VERSION', '2.3.8' );
14
  define( 'IMSANITY_SCHEMA_VERSION', '1.1' );
15
 
16
  define( 'IMSANITY_DEFAULT_MAX_WIDTH', 2048 );
@@ -42,19 +42,20 @@ include_once( plugin_dir_path(__FILE__) . 'settings.php' );
42
  include_once( plugin_dir_path(__FILE__) . 'ajax.php' );
43
 
44
  /**
45
- * Inspects the request and determines where the upload came from
 
46
  * @return IMSANITY_SOURCE_POST | IMSANITY_SOURCE_LIBRARY | IMSANITY_SOURCE_OTHER
47
  */
48
  function imsanity_get_source() {
49
  $id = array_key_exists('post_id', $_REQUEST) ? $_REQUEST['post_id'] : '';
50
  $action = array_key_exists('action', $_REQUEST) ? $_REQUEST['action'] : '';
51
-
52
  // a post_id indicates image is attached to a post
53
- if ($id > 0) return IMSANITY_SOURCE_POST;
54
 
55
  // post_id of 0 is 3.x otherwise use the action parameter
56
  if ( $id === 0 || $id === '0' || $action == 'upload-attachment' ) return IMSANITY_SOURCE_LIBRARY;
57
-
58
  // we don't know where this one came from but $_REQUEST['_wp_http_referer'] may contain info
59
  return IMSANITY_SOURCE_OTHER;
60
  }
@@ -93,7 +94,7 @@ function imsanity_get_max_width_height( $source ) {
93
  function imsanity_handle_upload( $params ) {
94
  /* debug logging... */
95
  // file_put_contents ( "debug.txt" , print_r($params,1) . "\n" );
96
-
97
  // if "noresize" is included in the filename then we will bypass imsanity scaling
98
  if ( strpos( $params['file'], 'noresize' ) !== false ) return $params;
99
 
@@ -101,7 +102,7 @@ function imsanity_handle_upload( $params ) {
101
  if ( $params['type'] == 'image/bmp' && imsanity_get_option( 'imsanity_bmp_to_jpg', IMSANITY_DEFAULT_BMP_TO_JPG ) ) {
102
  $params = imsanity_convert_to_jpg( 'bmp', $params );
103
  }
104
-
105
  if ( $params['type'] == 'image/png' && imsanity_get_option( 'imsanity_png_to_jpg', IMSANITY_DEFAULT_PNG_TO_JPG ) ) {
106
  $params = imsanity_convert_to_jpg( 'png', $params );
107
  }
@@ -116,8 +117,8 @@ function imsanity_handle_upload( $params ) {
116
  // $ud = wp_upload_dir();
117
  // $oldPath = $ud['path'] . DIRECTORY_SEPARATOR . $oldPath;
118
  // }
119
-
120
- if ( ( ! is_wp_error( $params ) ) && is_writable( $oldPath ) && in_array( $params['type'], array( 'image/png', 'image/gif', 'image/jpeg' ) ) ) {
121
 
122
  // figure out where the upload is coming from
123
  $source = imsanity_get_source();
@@ -125,24 +126,33 @@ function imsanity_handle_upload( $params ) {
125
  list( $maxW,$maxH ) = imsanity_get_max_width_height( $source );
126
 
127
  list( $oldW, $oldH ) = getimagesize( $oldPath );
128
-
129
  /* HACK: if getimagesize returns an incorrect value (sometimes due to bad EXIF data..?)
130
  $img = imagecreatefromjpeg ($oldPath);
131
  $oldW = imagesx ($img);
132
  $oldH = imagesy ($img);
133
  imagedestroy ($img);
134
  //*/
135
-
136
  /* HACK: an animated gif may have different frame sizes. to get the "screen" size
137
  $data = ''; // TODO: convert file to binary
138
- $header = unpack('@6/vwidth/vheight', $data );
139
  $oldW = $header['width'];
140
- $oldH = $header['width'];
141
  //*/
142
 
143
  if ( ( $oldW > $maxW && $maxW > 0 ) || ( $oldH > $maxH && $maxH > 0 ) ) {
144
  $quality = imsanity_get_option( 'imsanity_quality', IMSANITY_DEFAULT_QUALITY );
145
-
 
 
 
 
 
 
 
 
 
146
  if ( $oldW > $maxW && $maxW > 0 && $oldH > $maxH && $maxH > 0 && apply_filters( 'imsanity_crop_image', false ) ) {
147
  $newW = $maxW;
148
  $newH = $maxH;
@@ -175,10 +185,10 @@ function imsanity_handle_upload( $params ) {
175
  return $params;
176
  } else {
177
  // resize didn't work, likely because the image processing libraries are missing
178
-
179
  // remove the old image so we don't leave orphan files hanging around
180
  unlink( $oldPath );
181
-
182
  $params = wp_handle_upload_error( $oldPath ,
183
  sprintf( esc_html__( "Imsanity was unable to resize this image for the following reason: %s. If you continue to see this error message, you may need to install missing server components. If you think you have discovered a bug, please report it on the Imsanity support forum: %s", 'imsanity' ), $resizeResult->get_error_message(), 'https://wordpress.org/support/plugin/imsanity' ) );
184
 
@@ -203,7 +213,7 @@ function imsanity_convert_to_jpg( $type, $params )
203
  {
204
 
205
  $img = null;
206
-
207
  if ( $type == 'bmp' ) {
208
  include_once( 'libs/imagecreatefrombmp.php' );
209
  $img = imagecreatefrombmp( $params['file'] );
@@ -212,13 +222,12 @@ function imsanity_convert_to_jpg( $type, $params )
212
  return wp_handle_upload_error( $params['file'], esc_html__( 'Imsanity requires the GD library to convert PNG images to JPG', 'imsanity' ) );
213
  }
214
 
215
- $img = imagecreatefrompng( $params['file'] );
216
  // convert png transparency to white
217
- $bg = imagecreatetruecolor( imagesx( $img ), imagesy( $img ) );
218
- imagefill( $bg, 0, 0, imagecolorallocate( $bg, 255, 255, 255 ) );
219
- imagealphablending( $bg, TRUE );
220
- imagecopy($bg, $img, 0, 0, 0, 0, imagesx($img), imagesy($img));
221
-
222
  }
223
  else {
224
  return wp_handle_upload_error( $params['file'], esc_html__( 'Unknown image type specified in imsanity_convert_to_jpg', 'imsanity' ) );
@@ -229,13 +238,13 @@ function imsanity_convert_to_jpg( $type, $params )
229
  $oldFileName = basename($params['file']);
230
  $newFileName = basename(str_ireplace(".".$type, ".jpg", $oldFileName));
231
  $newFileName = wp_unique_filename( $uploads['path'], $newFileName );
232
-
233
  $quality = imsanity_get_option('imsanity_quality', IMSANITY_DEFAULT_QUALITY );
234
-
235
  if ( imagejpeg( $img, $uploads['path'] . '/' . $newFileName, $quality ) ) {
236
  // conversion succeeded. remove the original bmp & remap the params
237
  unlink($params['file']);
238
-
239
  $params['file'] = $uploads['path'] . '/' . $newFileName;
240
  $params['url'] = $uploads['url'] . '/' . $newFileName;
241
  $params['type'] = 'image/jpeg';
@@ -243,11 +252,11 @@ function imsanity_convert_to_jpg( $type, $params )
243
  else
244
  {
245
  unlink($params['file']);
246
-
247
  return wp_handle_upload_error( $oldPath,
248
  sprintf( esc_html__( "Imsanity was unable to process the %s file. If you continue to see this error you may need to disable the conversion option in the Imsanity settings.", 'imsanity' ), $type ) );
249
  }
250
-
251
  return $params;
252
  }
253
 
4
  Plugin URI: https://wordpress.org/plugins/imsanity/
5
  Description: Imsanity stops insanely huge image uploads
6
  Author: Shane Bishop
7
+ Version: 2.3.9
8
  Author URI: https://ewww.io/
9
  Text Domain: imsanity
10
  License: GPLv3
11
  */
12
 
13
+ define( 'IMSANITY_VERSION', '2.3.9' );
14
  define( 'IMSANITY_SCHEMA_VERSION', '1.1' );
15
 
16
  define( 'IMSANITY_DEFAULT_MAX_WIDTH', 2048 );
42
  include_once( plugin_dir_path(__FILE__) . 'ajax.php' );
43
 
44
  /**
45
+ * Inspects the request and determines where the upload came from.
46
+ *
47
  * @return IMSANITY_SOURCE_POST | IMSANITY_SOURCE_LIBRARY | IMSANITY_SOURCE_OTHER
48
  */
49
  function imsanity_get_source() {
50
  $id = array_key_exists('post_id', $_REQUEST) ? $_REQUEST['post_id'] : '';
51
  $action = array_key_exists('action', $_REQUEST) ? $_REQUEST['action'] : '';
52
+
53
  // a post_id indicates image is attached to a post
54
+ if ($id > 0) return IMSANITY_SOURCE_POST;
55
 
56
  // post_id of 0 is 3.x otherwise use the action parameter
57
  if ( $id === 0 || $id === '0' || $action == 'upload-attachment' ) return IMSANITY_SOURCE_LIBRARY;
58
+
59
  // we don't know where this one came from but $_REQUEST['_wp_http_referer'] may contain info
60
  return IMSANITY_SOURCE_OTHER;
61
  }
94
  function imsanity_handle_upload( $params ) {
95
  /* debug logging... */
96
  // file_put_contents ( "debug.txt" , print_r($params,1) . "\n" );
97
+
98
  // if "noresize" is included in the filename then we will bypass imsanity scaling
99
  if ( strpos( $params['file'], 'noresize' ) !== false ) return $params;
100
 
102
  if ( $params['type'] == 'image/bmp' && imsanity_get_option( 'imsanity_bmp_to_jpg', IMSANITY_DEFAULT_BMP_TO_JPG ) ) {
103
  $params = imsanity_convert_to_jpg( 'bmp', $params );
104
  }
105
+
106
  if ( $params['type'] == 'image/png' && imsanity_get_option( 'imsanity_png_to_jpg', IMSANITY_DEFAULT_PNG_TO_JPG ) ) {
107
  $params = imsanity_convert_to_jpg( 'png', $params );
108
  }
117
  // $ud = wp_upload_dir();
118
  // $oldPath = $ud['path'] . DIRECTORY_SEPARATOR . $oldPath;
119
  // }
120
+
121
+ if ( ( ! is_wp_error( $params ) ) && is_file( $oldPath ) && is_readable( $oldPath ) && is_writable( $oldPath ) && filesize( $oldPath ) > 0 && in_array( $params['type'], array( 'image/png', 'image/gif', 'image/jpeg' ) ) ) {
122
 
123
  // figure out where the upload is coming from
124
  $source = imsanity_get_source();
126
  list( $maxW,$maxH ) = imsanity_get_max_width_height( $source );
127
 
128
  list( $oldW, $oldH ) = getimagesize( $oldPath );
129
+
130
  /* HACK: if getimagesize returns an incorrect value (sometimes due to bad EXIF data..?)
131
  $img = imagecreatefromjpeg ($oldPath);
132
  $oldW = imagesx ($img);
133
  $oldH = imagesy ($img);
134
  imagedestroy ($img);
135
  //*/
136
+
137
  /* HACK: an animated gif may have different frame sizes. to get the "screen" size
138
  $data = ''; // TODO: convert file to binary
139
+ $header = unpack('@6/vwidth/vheight', $data );
140
  $oldW = $header['width'];
141
+ $oldH = $header['width'];
142
  //*/
143
 
144
  if ( ( $oldW > $maxW && $maxW > 0 ) || ( $oldH > $maxH && $maxH > 0 ) ) {
145
  $quality = imsanity_get_option( 'imsanity_quality', IMSANITY_DEFAULT_QUALITY );
146
+
147
+ $ftype = imsanity_quick_mimetype( $oldPath );
148
+ $orientation = imsanity_get_orientation( $oldPath, $ftype );
149
+ // If we are going to rotate the image 90 degrees during the resize, swap the existing image dimensions.
150
+ if ( 6 == $orientation || 8 == $orientation ) {
151
+ $old_oldW = $oldW;
152
+ $oldW = $oldH;
153
+ $oldH = $old_oldW;
154
+ }
155
+
156
  if ( $oldW > $maxW && $maxW > 0 && $oldH > $maxH && $maxH > 0 && apply_filters( 'imsanity_crop_image', false ) ) {
157
  $newW = $maxW;
158
  $newH = $maxH;
185
  return $params;
186
  } else {
187
  // resize didn't work, likely because the image processing libraries are missing
188
+
189
  // remove the old image so we don't leave orphan files hanging around
190
  unlink( $oldPath );
191
+
192
  $params = wp_handle_upload_error( $oldPath ,
193
  sprintf( esc_html__( "Imsanity was unable to resize this image for the following reason: %s. If you continue to see this error message, you may need to install missing server components. If you think you have discovered a bug, please report it on the Imsanity support forum: %s", 'imsanity' ), $resizeResult->get_error_message(), 'https://wordpress.org/support/plugin/imsanity' ) );
194
 
213
  {
214
 
215
  $img = null;
216
+
217
  if ( $type == 'bmp' ) {
218
  include_once( 'libs/imagecreatefrombmp.php' );
219
  $img = imagecreatefrombmp( $params['file'] );
222
  return wp_handle_upload_error( $params['file'], esc_html__( 'Imsanity requires the GD library to convert PNG images to JPG', 'imsanity' ) );
223
  }
224
 
225
+ $input = imagecreatefrompng( $params['file'] );
226
  // convert png transparency to white
227
+ $img = imagecreatetruecolor( imagesx( $input ), imagesy( $input ) );
228
+ imagefill( $img, 0, 0, imagecolorallocate( $img, 255, 255, 255 ) );
229
+ imagealphablending( $img, TRUE );
230
+ imagecopy($img, $input, 0, 0, 0, 0, imagesx($input), imagesy($input));
 
231
  }
232
  else {
233
  return wp_handle_upload_error( $params['file'], esc_html__( 'Unknown image type specified in imsanity_convert_to_jpg', 'imsanity' ) );
238
  $oldFileName = basename($params['file']);
239
  $newFileName = basename(str_ireplace(".".$type, ".jpg", $oldFileName));
240
  $newFileName = wp_unique_filename( $uploads['path'], $newFileName );
241
+
242
  $quality = imsanity_get_option('imsanity_quality', IMSANITY_DEFAULT_QUALITY );
243
+
244
  if ( imagejpeg( $img, $uploads['path'] . '/' . $newFileName, $quality ) ) {
245
  // conversion succeeded. remove the original bmp & remap the params
246
  unlink($params['file']);
247
+
248
  $params['file'] = $uploads['path'] . '/' . $newFileName;
249
  $params['url'] = $uploads['url'] . '/' . $newFileName;
250
  $params['type'] = 'image/jpeg';
252
  else
253
  {
254
  unlink($params['file']);
255
+
256
  return wp_handle_upload_error( $oldPath,
257
  sprintf( esc_html__( "Imsanity was unable to process the %s file. If you continue to see this error you may need to disable the conversion option in the Imsanity settings.", 'imsanity' ), $type ) );
258
  }
259
+
260
  return $params;
261
  }
262
 
libs/utils.php CHANGED
@@ -7,6 +7,7 @@
7
 
8
  /**
9
  * Util function returns an array value, if not defined then returns default instead.
 
10
  * @param Array $array
11
  * @param string $key
12
  * @param variant $default
@@ -15,6 +16,47 @@ function imsanity_val( $arr, $key, $default='' ) {
15
  return isset( $arr[$key] ) ? $arr[ $key ] : $default;
16
  }
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /**
19
  * output a fatal error and optionally die
20
  *
@@ -51,24 +93,25 @@ function imsanity_image_resize( $file, $max_w, $max_h, $crop = false, $suffix =
51
  return $editor;
52
  $editor->set_quality( $jpeg_quality );
53
 
54
- $ftype = pathinfo( $file, PATHINFO_EXTENSION );
55
-
 
56
  // try to correct for auto-rotation if the info is available
57
- if (function_exists('exif_read_data') && ($ftype == 'jpg' || $ftype == 'jpeg') ) {
58
- $exif = @exif_read_data($file);
59
- $orientation = is_array($exif) && array_key_exists('Orientation', $exif) ? $exif['Orientation'] : 0;
60
- switch($orientation) {
61
  case 3:
62
- $editor->rotate(180);
63
  break;
64
  case 6:
65
- $editor->rotate(-90);
66
  break;
67
  case 8:
68
- $editor->rotate(90);
69
  break;
70
  }
71
- }
72
 
73
  $resized = $editor->resize( $max_w, $max_h, $crop );
74
  if ( is_wp_error( $resized ) )
@@ -79,8 +122,8 @@ function imsanity_image_resize( $file, $max_w, $max_h, $crop = false, $suffix =
79
  // FIX: make sure that the destination file does not exist. this fixes
80
  // an issue during bulk resize where one of the optimized media filenames may get
81
  // used as the temporary file, which causes it to be deleted.
82
- while (file_exists($dest_file)) {
83
- $dest_file = $editor->generate_filename('TMP', $dest_path );
84
  }
85
 
86
  $saved = $editor->save( $dest_file );
7
 
8
  /**
9
  * Util function returns an array value, if not defined then returns default instead.
10
+ *
11
  * @param Array $array
12
  * @param string $key
13
  * @param variant $default
16
  return isset( $arr[$key] ) ? $arr[ $key ] : $default;
17
  }
18
 
19
+ /**
20
+ * Get mimetype based on file extension instead of file contents when speed outweighs accuracy.
21
+ *
22
+ * @param string $path The name of the file.
23
+ * @return string|bool The mime type based on the extension or false.
24
+ */
25
+ function imsanity_quick_mimetype( $path ) {
26
+ $pathextension = strtolower( pathinfo( $path, PATHINFO_EXTENSION ) );
27
+ switch ( $pathextension ) {
28
+ case 'jpg':
29
+ case 'jpeg':
30
+ case 'jpe':
31
+ return 'image/jpeg';
32
+ case 'png':
33
+ return 'image/png';
34
+ case 'gif':
35
+ return 'image/gif';
36
+ case 'pdf':
37
+ return 'application/pdf';
38
+ default:
39
+ return false;
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Gets the orientation/rotation of a JPG image using the EXIF data.
45
+ *
46
+ * @param string $file Name of the file.
47
+ * @param string $type Mime type of the file.
48
+ * @return int|bool The orientation value or false.
49
+ */
50
+ function imsanity_get_orientation( $file, $type ) {
51
+ if ( function_exists( 'exif_read_data' ) && 'image/jpeg' === $type ) {
52
+ $exif = @exif_read_data( $file );
53
+ if ( is_array( $exif ) && array_key_exists( 'Orientation', $exif ) ) {
54
+ return $exif['Orientation'];
55
+ }
56
+ }
57
+ return false;
58
+ }
59
+
60
  /**
61
  * output a fatal error and optionally die
62
  *
93
  return $editor;
94
  $editor->set_quality( $jpeg_quality );
95
 
96
+ $ftype = imsanity_quick_mimetype( $file );
97
+
98
+ $orientation = imsanity_get_orientation( $file, $ftype );
99
  // try to correct for auto-rotation if the info is available
100
+ // if ( function_exists( 'exif_read_data' ) && ( $ftype == 'image/jpeg' ) ) {
101
+ // $exif = @exif_read_data( $file );
102
+ // $orientation = is_array( $exif ) && array_key_exists( 'Orientation', $exif ) ? $exif['Orientation'] : 0;
103
+ switch ( $orientation ) {
104
  case 3:
105
+ $editor->rotate( 180 );
106
  break;
107
  case 6:
108
+ $editor->rotate( -90 );
109
  break;
110
  case 8:
111
+ $editor->rotate( 90 );
112
  break;
113
  }
114
+ // }
115
 
116
  $resized = $editor->resize( $max_w, $max_h, $crop );
117
  if ( is_wp_error( $resized ) )
122
  // FIX: make sure that the destination file does not exist. this fixes
123
  // an issue during bulk resize where one of the optimized media filenames may get
124
  // used as the temporary file, which causes it to be deleted.
125
+ while ( file_exists( $dest_file ) ) {
126
+ $dest_file = $editor->generate_filename( 'TMP', $dest_path );
127
  }
128
 
129
  $saved = $editor->save( $dest_file );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nosilver4u,verysimple
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MKMQKCBFFG3WW
4
  Tags: image, scale, resize, space saver, quality
5
  Requires at least: 4.0
6
- Tested up to: 4.7
7
- Stable tag: 2.3.8
8
 
9
  Imsanity automatically resizes huge image uploads. Are contributors uploading huge photos? Tired of manually scaling? Imsanity to the rescue!
10
 
@@ -144,7 +144,11 @@ Questions may be posted on the support forum at https://wordpress.org/support/pl
144
 
145
  == Changelog ==
146
 
147
- As some already know, Jason Hinkle passed away earlier this year. He will be sorely missed, but I hope to continue his legacy, to improve and support Imsanity. Who am I? https://ewww.io
 
 
 
 
148
 
149
  = 2.3.8 =
150
  * added: 'imsanity_crop_image' filter to crop images during resizing
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MKMQKCBFFG3WW
4
  Tags: image, scale, resize, space saver, quality
5
  Requires at least: 4.0
6
+ Tested up to: 4.7.4
7
+ Stable tag: 2.3.9
8
 
9
  Imsanity automatically resizes huge image uploads. Are contributors uploading huge photos? Tired of manually scaling? Imsanity to the rescue!
10
 
144
 
145
  == Changelog ==
146
 
147
+ = 2.3.9 =
148
+ * fixed: PNG to JPG filled transparency with black instead of white
149
+ * fixed: auto-rotation causes incorrect scaling
150
+ * fixed: results box stops scrolling at line 28
151
+ * added: pre-emptive checks on file parameter to prevent read errors with getimagesize()
152
 
153
  = 2.3.8 =
154
  * added: 'imsanity_crop_image' filter to crop images during resizing
scripts/imsanity.js CHANGED
@@ -48,8 +48,7 @@ function imsanity_resize_next(images,next_index)
48
  }
49
  }
50
 
51
- target.animate({scrollTop: target.height()});
52
-
53
  // recurse
54
  imsanity_resize_next(images,next_index+1);
55
  }
@@ -63,7 +62,7 @@ function imsanity_resize_complete()
63
  {
64
  var target = jQuery('#resize_results');
65
  target.append('<div><strong>' + imsanity_vars.resizing_complete + '</strong></div>');
66
- target.animate({scrollTop: target.height()});
67
  }
68
 
69
  /**
48
  }
49
  }
50
 
51
+ target.animate({scrollTop: target.prop('scrollHeight')}, 200);
 
52
  // recurse
53
  imsanity_resize_next(images,next_index+1);
54
  }
62
  {
63
  var target = jQuery('#resize_results');
64
  target.append('<div><strong>' + imsanity_vars.resizing_complete + '</strong></div>');
65
+ target.animate({scrollTop: target.prop('scrollHeight')});
66
  }
67
 
68
  /**
settings.php CHANGED
@@ -61,7 +61,7 @@ function imsanity_queue_script( $hook ) {
61
  return;
62
  }
63
  // register the scripts that are used by the bulk resizer
64
- wp_enqueue_script( 'imsanity_script', plugins_url( '/imsanity/scripts/imsanity.js' ), array( 'jquery' ), IMSANITY_VERSION );
65
  wp_localize_script( 'imsanity_script', 'imsanity_vars', array(
66
  '_wpnonce' => wp_create_nonce( 'imsanity-bulk' ),
67
  'resizing_complete' => esc_html__( 'Resizing Complete', 'imsanity' ),
61
  return;
62
  }
63
  // register the scripts that are used by the bulk resizer
64
+ wp_enqueue_script( 'imsanity_script', plugins_url( '/scripts/imsanity.js', __FILE__ ), array( 'jquery' ), IMSANITY_VERSION );
65
  wp_localize_script( 'imsanity_script', 'imsanity_vars', array(
66
  '_wpnonce' => wp_create_nonce( 'imsanity-bulk' ),
67
  'resizing_complete' => esc_html__( 'Resizing Complete', 'imsanity' ),