Changeset 35561 for trunk/src/wp-includes/media.php
- Timestamp:
- 11/07/2015 02:09:56 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/media.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r35524 r35561 984 984 } 985 985 986 // Don't add srcset attributes to (animated) gifs that are inserted at full size.987 if ( isset( $image_sizes['thumbnail']['mime-type'] ) && 'image/gif' === $image_sizes['thumbnail']['mime-type'] &&988 false !== strpos( $image_src, $image_meta['file'] ) ) {989 990 return false;991 }992 993 986 $image_basename = wp_basename( $image_meta['file'] ); 994 987 $image_baseurl = _wp_upload_dir_baseurl(); 995 988 996 // Add full size to the '$image_sizes' array. 997 $image_sizes['full'] = array( 998 'width' => $image_meta['width'], 999 'height' => $image_meta['height'], 1000 'file' => $image_basename, 1001 ); 989 /* 990 * WordPress flattens animated GIFs into one frame when generating intermediate sizes. 991 * To avoid hiding animation in user content, if src is a full size GIF, a srcset attribute is not generated. 992 * If src is an intermediate size GIF, the full size is excluded from srcset to keep a flattened GIF from becoming animated. 993 */ 994 if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' !== $image_sizes['thumbnail']['mime-type'] ) { 995 $image_sizes['full'] = array( 996 'width' => $image_meta['width'], 997 'height' => $image_meta['height'], 998 'file' => $image_basename, 999 ); 1000 } elseif ( strpos( $image_src, $image_meta['file'] ) ) { 1001 return false; 1002 } 1002 1003 1003 1004 // Uploads are (or have been) in year/month sub-directories.
Note: See TracChangeset
for help on using the changeset viewer.