EWWW Image Optimizer - Version 6.1.1

Version Description

  • change: added setting to enable adding of missing width/height dimensions, disabled by default
  • fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
Download this release

Release Info

Developer nosilver4u
Plugin Icon 128x128 EWWW Image Optimizer
Version 6.1.1
Comparing to
See all releases

Code changes from version 6.1.0 to 6.1.1

bulk.php CHANGED
@@ -1133,7 +1133,6 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
1133
  continue;
1134
  }
1135
  ewwwio_debug_message( "id: $selected_id and type: $mime" );
1136
- ewww_image_optimizer_debug_log();
1137
  $attached_file = ( ! empty( $attachment_meta[ $selected_id ]['_wp_attached_file'] ) ? $attachment_meta[ $selected_id ]['_wp_attached_file'] : '' );
1138
 
1139
  list( $file_path, $upload_path ) = ewww_image_optimizer_attachment_path( $meta, $selected_id, $attached_file, false );
@@ -1142,7 +1141,6 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
1142
  if ( class_exists( 'Amazon_S3_And_CloudFront' ) && ewww_image_optimizer_stream_wrapped( $file_path ) ) {
1143
  ewww_image_optimizer_check_table_as3cf( $meta, $selected_id, $file_path );
1144
  }
1145
- ewww_image_optimizer_debug_log();
1146
  if (
1147
  ( ewww_image_optimizer_stream_wrapped( $file_path ) || ! ewwwio_is_file( $file_path ) ) &&
1148
  (
@@ -1178,6 +1176,13 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
1178
  continue;
1179
  }
1180
 
 
 
 
 
 
 
 
1181
  $should_resize = ewww_image_optimizer_should_resize( $file_path, true );
1182
  if (
1183
  ! empty( $attachment_meta[ $selected_id ]['tinypng'] ) &&
1133
  continue;
1134
  }
1135
  ewwwio_debug_message( "id: $selected_id and type: $mime" );
 
1136
  $attached_file = ( ! empty( $attachment_meta[ $selected_id ]['_wp_attached_file'] ) ? $attachment_meta[ $selected_id ]['_wp_attached_file'] : '' );
1137
 
1138
  list( $file_path, $upload_path ) = ewww_image_optimizer_attachment_path( $meta, $selected_id, $attached_file, false );
1141
  if ( class_exists( 'Amazon_S3_And_CloudFront' ) && ewww_image_optimizer_stream_wrapped( $file_path ) ) {
1142
  ewww_image_optimizer_check_table_as3cf( $meta, $selected_id, $file_path );
1143
  }
 
1144
  if (
1145
  ( ewww_image_optimizer_stream_wrapped( $file_path ) || ! ewwwio_is_file( $file_path ) ) &&
1146
  (
1176
  continue;
1177
  }
1178
 
1179
+ // Early check for bypass based on full-size path.
1180
+ if ( apply_filters( 'ewww_image_optimizer_bypass', false, $file_path ) === true ) {
1181
+ ewwwio_debug_message( "skipping $file_path as instructed" );
1182
+ ewww_image_optimizer_debug_log();
1183
+ continue;
1184
+ }
1185
+
1186
  $should_resize = ewww_image_optimizer_should_resize( $file_path, true );
1187
  if (
1188
  ! empty( $attachment_meta[ $selected_id ]['tinypng'] ) &&
changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 6.1.0 =
2
  * added: ability to use SVG placeholders for more efficient lazy load
3
  * added: Easy IO and Lazy Load add missing width and height to image elements
1
+ = 6.1.1 =
2
+ * change: added setting to enable adding of missing width/height dimensions, disabled by default
3
+ * fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
4
+
5
  = 6.1.0 =
6
  * added: ability to use SVG placeholders for more efficient lazy load
7
  * added: Easy IO and Lazy Load add missing width and height to image elements
classes/class-eio-lazy-load.php CHANGED
@@ -176,7 +176,7 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
176
  * @param string $tag_name The type of HTML tag/element being parsed.
177
  * @return bool False for img elements, leave as-is for others.
178
  */
179
- function wp_lazy_loading_enabled( $default, $tag_name ) {
180
  if ( 'img' === $tag_name ) {
181
  if ( defined( 'EIO_ENABLE_NATIVE_LAZY' ) && EIO_ENABLE_NATIVE_LAZY ) {
182
  return true;
@@ -438,7 +438,7 @@ if ( ! class_exists( 'EIO_Lazy_Load' ) ) {
438
  $placeholder_src = $this->placeholder_src;
439
 
440
  $insert_dimensions = false;
441
- if ( apply_filters( 'eio_add_missing_width_height_attrs', true ) && ( empty( $width_attr ) || empty( $height_attr ) ) ) {
442
  $this->debug_message( 'missing width attr or height attr' );
443
  list( $width_attr, $height_attr ) = $this->get_image_dimensions_by_url( $file );
444
  if ( $width_attr && is_numeric( $width_attr ) && $height_attr && is_numeric( $height_attr ) ) {
176
  * @param string $tag_name The type of HTML tag/element being parsed.
177
  * @return bool False for img elements, leave as-is for others.
178
  */
179
+ function wp_lazy_loading_enabled( $default, $tag_name = 'img' ) {
180
  if ( 'img' === $tag_name ) {
181
  if ( defined( 'EIO_ENABLE_NATIVE_LAZY' ) && EIO_ENABLE_NATIVE_LAZY ) {
182
  return true;
438
  $placeholder_src = $this->placeholder_src;
439
 
440
  $insert_dimensions = false;
441
+ if ( apply_filters( 'eio_add_missing_width_height_attrs', $this->get_option( $this->prefix . 'add_missing_dims' ) ) && ( empty( $width_attr ) || empty( $height_attr ) ) ) {
442
  $this->debug_message( 'missing width attr or height attr' );
443
  list( $width_attr, $height_attr ) = $this->get_image_dimensions_by_url( $file );
444
  if ( $width_attr && is_numeric( $width_attr ) && $height_attr && is_numeric( $height_attr ) ) {
classes/class-exactdn.php CHANGED
@@ -986,7 +986,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
986
 
987
  // Get width/height attributes from the URL/file if they are missing.
988
  $insert_dimensions = false;
989
- if ( apply_filters( 'eio_add_missing_width_height_attrs', true ) && ( empty( $width ) || empty( $height ) ) ) {
990
  $this->debug_message( 'missing width attr or height attr' );
991
  $insert_dimensions = true;
992
  }
@@ -1299,7 +1299,7 @@ if ( ! class_exists( 'ExactDN' ) ) {
1299
  $width_attr = $this->get_attribute( $images['img_tag'][ $index ], 'width' );
1300
  // Get width/height attributes from the URL/file if they are missing.
1301
  $insert_dimensions = false;
1302
- if ( apply_filters( 'eio_add_missing_width_height_attrs', true ) && empty( $width_attr ) ) {
1303
  $this->debug_message( 'missing width attr or height attr' );
1304
  $insert_dimensions = true;
1305
  }
986
 
987
  // Get width/height attributes from the URL/file if they are missing.
988
  $insert_dimensions = false;
989
+ if ( apply_filters( 'eio_add_missing_width_height_attrs', $this->get_option( $this->prefix . 'add_missing_dims' ) ) && ( empty( $width ) || empty( $height ) ) ) {
990
  $this->debug_message( 'missing width attr or height attr' );
991
  $insert_dimensions = true;
992
  }
1299
  $width_attr = $this->get_attribute( $images['img_tag'][ $index ], 'width' );
1300
  // Get width/height attributes from the URL/file if they are missing.
1301
  $insert_dimensions = false;
1302
+ if ( apply_filters( 'eio_add_missing_width_height_attrs', $this->get_option( $this->prefix . 'add_missing_dims' ) ) && empty( $width_attr ) ) {
1303
  $this->debug_message( 'missing width attr or height attr' );
1304
  $insert_dimensions = true;
1305
  }
common.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
- define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '610' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
@@ -630,6 +630,8 @@ function ewww_image_optimizer_save_network_settings() {
630
  update_site_option( 'exactdn_lossy', $exactdn_lossy );
631
  $exactdn_exclude = empty( $_POST['exactdn_exclude'] ) ? '' : sanitize_textarea_field( wp_unslash( $_POST['exactdn_exclude'] ) );
632
  update_site_option( 'exactdn_exclude', ewww_image_optimizer_exclude_paths_sanitize( $exactdn_exclude ) );
 
 
633
  $ewww_image_optimizer_lazy_load = ( empty( $_POST['ewww_image_optimizer_lazy_load'] ) ? false : true );
634
  update_site_option( 'ewww_image_optimizer_lazy_load', $ewww_image_optimizer_lazy_load );
635
  $ewww_image_optimizer_ll_autoscale = ( empty( $_POST['ewww_image_optimizer_ll_autoscale'] ) ? false : true );
@@ -1006,6 +1008,7 @@ function ewww_image_optimizer_admin_init() {
1006
  register_setting( 'ewww_image_optimizer_options', 'exactdn_all_the_things', 'boolval' );
1007
  register_setting( 'ewww_image_optimizer_options', 'exactdn_lossy', 'boolval' );
1008
  register_setting( 'ewww_image_optimizer_options', 'exactdn_exclude', 'ewww_image_optimizer_exclude_paths_sanitize' );
 
1009
  register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_lazy_load', 'boolval' );
1010
  register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_ll_autoscale', 'boolval' );
1011
  register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_use_lqip', 'boolval' );
@@ -10390,6 +10393,7 @@ function ewwwio_debug_info() {
10390
  ewwwio_debug_message( 'Easy IO exclusions:' );
10391
  $eio_exclude_paths = ewww_image_optimizer_get_option( 'exactdn_exclude' ) ? esc_html( implode( "\n", ewww_image_optimizer_get_option( 'exactdn_exclude' ) ) ) : '';
10392
  ewwwio_debug_message( $eio_exclude_paths );
 
10393
  ewwwio_debug_message( 'lazy load: ' . ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_lazy_load' ) ? 'on' : 'off' ) );
10394
  ewwwio_other_lazy_detected();
10395
  ewwwio_debug_message( 'LL autoscale: ' . ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_ll_autoscale' ) ? 'on' : 'off' ) );
@@ -11936,6 +11940,25 @@ function ewww_image_optimizer_options( $network = 'singlesite' ) {
11936
  <p class='description'>
11937
  <?php esc_html_e( 'Resize uploaded images to these dimensions (in pixels).', 'ewww-image-optimizer' ); ?>
11938
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11939
  <?php endif; ?>
11940
  </td>
11941
  </tr>
@@ -12178,7 +12201,7 @@ AddType image/webp .webp</pre>
12178
  <?php endif; ?>
12179
  </td>
12180
  </tr>
12181
- <tr class='ewww_image_optimizer_webp_setting_container' <?php echo ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp' ) ? '' : ' style="display:none"'; ?>>
12182
  <th>&nbsp;</th>
12183
  <td>
12184
  <input type='checkbox' id='ewww_image_optimizer_webp_for_cdn' name='ewww_image_optimizer_webp_for_cdn' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp_for_cdn' ) ); ?> />
@@ -12190,7 +12213,7 @@ AddType image/webp .webp</pre>
12190
  </p>
12191
  </td>
12192
  </tr>
12193
- <tr class='ewww_image_optimizer_webp_setting_container' <?php echo ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp' ) ? '' : ' style="display:none"'; ?>>
12194
  <th>&nbsp;</th>
12195
  <td>
12196
  <input type='checkbox' id='ewww_image_optimizer_picture_webp' name='ewww_image_optimizer_picture_webp' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_picture_webp' ) ); ?> />
14
  exit;
15
  }
16
 
17
+ define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '611' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
630
  update_site_option( 'exactdn_lossy', $exactdn_lossy );
631
  $exactdn_exclude = empty( $_POST['exactdn_exclude'] ) ? '' : sanitize_textarea_field( wp_unslash( $_POST['exactdn_exclude'] ) );
632
  update_site_option( 'exactdn_exclude', ewww_image_optimizer_exclude_paths_sanitize( $exactdn_exclude ) );
633
+ $ewww_image_optimizer_add_missing_dims = ( empty( $_POST['ewww_image_optimizer_add_missing_dims'] ) ? false : true );
634
+ update_site_option( 'ewww_image_optimizer_add_missing_dims', $ewww_image_optimizer_add_missing_dims );
635
  $ewww_image_optimizer_lazy_load = ( empty( $_POST['ewww_image_optimizer_lazy_load'] ) ? false : true );
636
  update_site_option( 'ewww_image_optimizer_lazy_load', $ewww_image_optimizer_lazy_load );
637
  $ewww_image_optimizer_ll_autoscale = ( empty( $_POST['ewww_image_optimizer_ll_autoscale'] ) ? false : true );
1008
  register_setting( 'ewww_image_optimizer_options', 'exactdn_all_the_things', 'boolval' );
1009
  register_setting( 'ewww_image_optimizer_options', 'exactdn_lossy', 'boolval' );
1010
  register_setting( 'ewww_image_optimizer_options', 'exactdn_exclude', 'ewww_image_optimizer_exclude_paths_sanitize' );
1011
+ register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_add_missing_dims', 'boolval' );
1012
  register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_lazy_load', 'boolval' );
1013
  register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_ll_autoscale', 'boolval' );
1014
  register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_use_lqip', 'boolval' );
10393
  ewwwio_debug_message( 'Easy IO exclusions:' );
10394
  $eio_exclude_paths = ewww_image_optimizer_get_option( 'exactdn_exclude' ) ? esc_html( implode( "\n", ewww_image_optimizer_get_option( 'exactdn_exclude' ) ) ) : '';
10395
  ewwwio_debug_message( $eio_exclude_paths );
10396
+ ewwwio_debug_message( 'add missing dimensions: ' . ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_add_missing_dims' ) ? 'on' : 'off' ) );
10397
  ewwwio_debug_message( 'lazy load: ' . ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_lazy_load' ) ? 'on' : 'off' ) );
10398
  ewwwio_other_lazy_detected();
10399
  ewwwio_debug_message( 'LL autoscale: ' . ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_ll_autoscale' ) ? 'on' : 'off' ) );
11940
  <p class='description'>
11941
  <?php esc_html_e( 'Resize uploaded images to these dimensions (in pixels).', 'ewww-image-optimizer' ); ?>
11942
  </p>
11943
+ <?php endif; ?>
11944
+ </td>
11945
+ </tr>
11946
+ <tr>
11947
+ <th scope='row'>
11948
+ <label for='ewww_image_optimizer_add_missing_dims'>
11949
+ <?php esc_html_e( 'Add Missing Dimensions', 'ewww-image-optimizer' ); ?>
11950
+ </label>
11951
+ </th>
11952
+ <td>
11953
+ <?php if ( function_exists( 'easyio_get_option' ) && easyio_get_option( 'easyio_lazy_load' ) && easyio_get_option( 'easyio_add_missing_dims' ) ) : ?>
11954
+ <p class='description'><?php esc_html_e( 'Enabled in Easy Image Optimizer.', 'ewww-image-optimizer' ); ?></p>
11955
+ <input type='hidden' id='ewww_image_optimizer_add_missing_dims' name='ewww_image_optimizer_add_missing_dims' <?php echo ( ewww_image_optimizer_get_option( 'ewww_image_optimizer_add_missing_dims' ) ? "value='1'" : "value='0'" ); ?> />
11956
+ <?php else : ?>
11957
+ <input type='checkbox' id='ewww_image_optimizer_add_missing_dims' name='ewww_image_optimizer_add_missing_dims' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_add_missing_dims' ) ); ?> <?php disabled( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_lazy_load' ) ); ?> />
11958
+ <?php esc_html_e( 'Add width/height attributes to reduce layout shifts and improve user experience.', 'ewww-image-optimizer' ); ?>
11959
+ <?php if ( ! ewww_image_optimizer_get_option( 'ewww_image_optimizer_lazy_load' ) ) : ?>
11960
+ <p class ='description'>*<?php esc_html_e( 'Requires Lazy Load.', 'ewww-image-optimizer' ); ?></p>
11961
+ <?php endif; ?>
11962
  <?php endif; ?>
11963
  </td>
11964
  </tr>
12201
  <?php endif; ?>
12202
  </td>
12203
  </tr>
12204
+ <tr class='ewww_image_optimizer_webp_setting_container' <?php echo ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp' ) || ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp_for_cdn' ) ? '' : ' style="display:none"'; ?>>
12205
  <th>&nbsp;</th>
12206
  <td>
12207
  <input type='checkbox' id='ewww_image_optimizer_webp_for_cdn' name='ewww_image_optimizer_webp_for_cdn' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp_for_cdn' ) ); ?> />
12213
  </p>
12214
  </td>
12215
  </tr>
12216
+ <tr class='ewww_image_optimizer_webp_setting_container' <?php echo ewww_image_optimizer_get_option( 'ewww_image_optimizer_webp' ) || ewww_image_optimizer_get_option( 'ewww_image_optimizer_picture_webp' ) ? '' : ' style="display:none"'; ?>>
12217
  <th>&nbsp;</th>
12218
  <td>
12219
  <input type='checkbox' id='ewww_image_optimizer_picture_webp' name='ewww_image_optimizer_picture_webp' value='true' <?php checked( ewww_image_optimizer_get_option( 'ewww_image_optimizer_picture_webp' ) ); ?> />
ewww-image-optimizer.php CHANGED
@@ -13,7 +13,7 @@ Plugin Name: EWWW Image Optimizer
13
  Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
14
  Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
15
  Author: Exactly WWW
16
- Version: 6.1.0
17
  Author URI: https://ewww.io/
18
  License: GPLv3
19
  */
13
  Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
14
  Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
15
  Author: Exactly WWW
16
+ Version: 6.1.1
17
  Author URI: https://ewww.io/
18
  License: GPLv3
19
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: optimize, image, convert, webp, resize, compress, lazy load, optimization,
5
  Requires at least: 5.4
6
  Tested up to: 5.7
7
  Requires PHP: 7.1
8
- Stable tag: 6.1.0
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
@@ -132,6 +132,10 @@ That's not a question, but since I made it up, I'll answer it. See this resource
132
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io)
133
  * If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
134
 
 
 
 
 
135
  = 6.1.0 =
136
  * added: ability to use SVG placeholders for more efficient lazy load
137
  * added: Easy IO and Lazy Load add missing width and height to image elements
5
  Requires at least: 5.4
6
  Tested up to: 5.7
7
  Requires PHP: 7.1
8
+ Stable tag: 6.1.1
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
132
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io)
133
  * If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
134
 
135
+ = 6.1.1 =
136
+ * change: added setting to enable adding of missing width/height dimensions, disabled by default
137
+ * fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
138
+
139
  = 6.1.0 =
140
  * added: ability to use SVG placeholders for more efficient lazy load
141
  * added: Easy IO and Lazy Load add missing width and height to image elements