diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php index d6e6fbd563..56dd5510dd 100644 --- a/src/wp-admin/includes/image.php +++ b/src/wp-admin/includes/image.php @@ -357,7 +357,7 @@ function wp_read_image_metadata( $file ) { return false; } - list( , , $sourceImageType ) = @getimagesize( $file ); + list( , , $image_type ) = @getimagesize( $file ); /* * EXIF contains a bunch of data we'll probably never need formatted in ways @@ -444,7 +444,9 @@ function wp_read_image_metadata( $file ) { * * @param array $image_types Image types to check for exif data. */ - if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) { + $exif_image_types = apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ); + + if ( is_callable( 'exif_read_data' ) && in_array( $image_type, $exif_image_types ) ) { $exif = @exif_read_data( $file ); if ( ! empty( $exif['ImageDescription'] ) ) { @@ -523,12 +525,12 @@ function wp_read_image_metadata( $file ) { * @since 2.5.0 * @since 4.4.0 The `$iptc` parameter was added. * - * @param array $meta Image meta data. - * @param string $file Path to image file. - * @param int $sourceImageType Type of image. - * @param array $iptc IPTC data. + * @param array $meta Image meta data. + * @param string $file Path to image file. + * @param int $image_type Type of image, one of the `IMAGETYPE_XXX` constants. + * @param array $iptc IPTC data. */ - return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc ); + return apply_filters( 'wp_read_image_metadata', $meta, $file, $image_type, $iptc ); }