getimagesize_mimes_to_exts
Filters the list mapping image mime types to their respective extensions.
Usage
add_filter( 'getimagesize_mimes_to_exts', 'wp_kama_getimagesize_mimes_to_exts_filter' ); /** * Function for `getimagesize_mimes_to_exts` filter-hook. * * @param array $mime_to_ext Array of image mime types and their matching extensions. * * @return array */ function wp_kama_getimagesize_mimes_to_exts_filter( $mime_to_ext ){ // filter... return $mime_to_ext; }
- $mime_to_ext(array)
- Array of image mime types and their matching extensions.
Changelog
Since 3.0.0 | Introduced. |
Where the hook is called
getimagesize_mimes_to_exts
wp-includes/functions.php 3118-3140
$mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array( 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/tiff' => 'tif', 'image/webp' => 'webp', 'image/avif' => 'avif', /* * In theory there are/should be file extensions that correspond to the * mime types: .heif, .heics and .heifs. However it seems that HEIC images * with any of the mime types commonly have a .heic file extension. * Seems keeping the status quo here is best for compatibility. */ 'image/heic' => 'heic', 'image/heif' => 'heic', 'image/heic-sequence' => 'heic', 'image/heif-sequence' => 'heic', ) );