Changeset 50814 for trunk/src/wp-includes/media.php
- Timestamp:
- 05/05/2021 05:06:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r50810 r50814 5025 5025 * @since 5.8.0 5026 5026 * 5027 * @param [type]$filename Path to a WebP file.5027 * @param string $filename Path to a WebP file. 5028 5028 * @return array $webp_info { 5029 5029 * An array of WebP image information. … … 5039 5039 $height = false; 5040 5040 $type = false; 5041 5041 5042 if ( ! 'image/webp' === wp_get_image_mime( $filename ) ) { 5042 5043 return compact( 'width', 'height', 'type' ); 5043 5044 } 5045 5044 5046 try { 5045 5047 $handle = fopen( $filename, 'rb' ); … … 5084 5086 } catch ( Exception $e ) { 5085 5087 } 5088 5086 5089 return compact( 'width', 'height', 'type' ); 5087 5090 } … … 5098 5101 $webp_info = wp_get_webp_info( $filename ); 5099 5102 $type = $webp_info['type']; 5103 5100 5104 return $type && 'lossy' === $type; 5101 5105 } … … 5114 5118 // Try getimagesize() first. 5115 5119 $info = getimagesize( $filename, $imageinfo ); 5120 5116 5121 if ( false !== $info ) { 5117 5122 return $info; 5118 5123 } 5119 // For PHP versions that don't support WebP images, extract the image 5120 // size info from the file headers. 5124 5125 // For PHP versions that don't support WebP images, 5126 // extract the image size info from the file headers. 5121 5127 if ( 'image/webp' === wp_get_image_mime( $filename ) ) { 5122 5128 $webp_info = wp_get_webp_info( $filename ); … … 5124 5130 $height = $webp_info['height']; 5125 5131 5126 5132 // Mimic the native return format. 5127 5133 if ( $width && $height ) { 5128 5134 return array(
Note: See TracChangeset
for help on using the changeset viewer.