// We can't do any further validation without a file to work with.
if ( !
file_exists( $file ) ) { return compact( 'ext', 'type', 'proper_filename'
);
} $real_mime = false;
// Validate image types.
if ( $type &&
str_starts_with( $type, 'image/'
) ) { // Attempt to figure out what type of image it actually is.
$real_mime =
wp_get_image_mime( $file );
if ( $real_mime &&
$real_mime !=
$type ) { /**
* Filters the list mapping image mime types to their respective extensions.
*
* @since 3.0.0
*
* @param array $mime_to_ext Array of image mime types and their matching extensions.
*/
$mime_to_ext =
apply_filters( 'getimagesize_mimes_to_exts',