Changeset 2961967
- Timestamp:
- 09/02/2023 01:14:09 PM (3 years ago)
- Location:
- easy-optimizer
- Files:
-
- 2 edited
-
tags/1.0.8/easy-optimizer.php (modified) (2 diffs)
-
trunk/easy-optimizer.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easy-optimizer/tags/1.0.8/easy-optimizer.php
r2961962 r2961967 217 217 // Check if the img tag is among the first excluded images 218 218 $is_first_excluded_image = ( $image_index < $exclude_first ); 219 220 if ( ! $is_excluded && ! $is_first_excluded_image ) { 221 // Check if the img tag has srcset 222 $has_srcset = $img->hasAttribute( 'srcset' ); 223 $imgwidth = $img->getAttribute( 'width' ); 224 $imgheight = $img->getAttribute( 'height' ); 225 if (empty($imgwidth) && empty($imgheight)) { 219 $imgwidth = $img->getAttribute( 'width' ); 220 $imgheight = $img->getAttribute( 'height' ); 221 if (empty($imgwidth) && empty($imgheight)) { 226 222 $src = $img->getAttribute('src'); 227 223 list($width, $height) = getimagesize($src); … … 230 226 $img->setAttribute('height', $height); 231 227 } 232 } 228 } 229 230 if ( ! $is_excluded && ! $is_first_excluded_image ) { 231 // Check if the img tag has srcset 232 $has_srcset = $img->hasAttribute( 'srcset' ); 233 233 234 if (!empty($width) && !empty($height)) { 234 235 $placeholder = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 $width $height'%3E%3C/svg%3E"; -
easy-optimizer/trunk/easy-optimizer.php
r2961962 r2961967 217 217 // Check if the img tag is among the first excluded images 218 218 $is_first_excluded_image = ( $image_index < $exclude_first ); 219 220 if ( ! $is_excluded && ! $is_first_excluded_image ) { 221 // Check if the img tag has srcset 222 $has_srcset = $img->hasAttribute( 'srcset' ); 223 $imgwidth = $img->getAttribute( 'width' ); 224 $imgheight = $img->getAttribute( 'height' ); 225 if (empty($imgwidth) && empty($imgheight)) { 219 $imgwidth = $img->getAttribute( 'width' ); 220 $imgheight = $img->getAttribute( 'height' ); 221 if (empty($imgwidth) && empty($imgheight)) { 226 222 $src = $img->getAttribute('src'); 227 223 list($width, $height) = getimagesize($src); … … 230 226 $img->setAttribute('height', $height); 231 227 } 232 } 228 } 229 230 if ( ! $is_excluded && ! $is_first_excluded_image ) { 231 // Check if the img tag has srcset 232 $has_srcset = $img->hasAttribute( 'srcset' ); 233 233 234 if (!empty($width) && !empty($height)) { 234 235 $placeholder = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 $width $height'%3E%3C/svg%3E";
Note: See TracChangeset
for help on using the changeset viewer.