API / Minn\Media / ImageMime

ImageMime final class

Minn\Media\ImageMime · public/minn/src/Minn/Media/ImageMime.php · 34 lines

An image file's real type from its first bytes, as the reference sniffs it before trusting an upload's extension (probe hook-inputs-2): PHP's own header check for the classic formats (JPEG, PNG, GIF, WebP, BMP, ICO, TIFF, AVIF), then an ISO media file's major brand for the HEIF family PHP does not know. A file too short or of another kind has no image type.

Constants and properties

privateBRANDS = array ( 'heic' => 'image/heic', 'heix' => 'image/heic', 'hevc' => 'image/heic-sequence', 'hevx' => 'image/heic-sequence', 'mif1' => 'image/heif', 'heim' => 'image/heif', 'heis' => 'image/heif', 'msf1' => 'image/heif-sequence', 'avif' => 'image/avif', 'avis' => 'image/avif', )

An ISO base media file's major brand and the image type it declares.

Public

staticof(string $file): ?string#

The image type the file's header declares, or null.