exif_imagetype
exif_imagetype
Determine the type of an image
**exif_imagetype** string $filename
reads the first bytes of an image and
checks its signature.
exif_imagetype
can be used to avoid calls to other
functions with unsupported file types
or in conjunction with to check
whether or not the viewer is able to see a specific image in the browser.
exif_imagetypeexif$_SERVER['HTTP_ACCEPT']
filenameThe image being checked.
When a correct signature is found, the appropriate constant value will be
returned otherwise the return value is false. The return value is the
same value that returns in index 2 but
is much faster.
getimagesize``exif_imagetype
The following constants are defined, and represent possible
return values:
exif_imagetype
Opmerking: > will emit an and return false if it is unable to read enough bytes from the file to determine the image type.
`exif_imagetype``E_NOTICE`
Voorbeeld: example
<?php
if (exif_imagetype('image.gif') != IMAGETYPE_GIF) {
echo 'The picture is not a gif';
}
?>
image_type_to_mime_type``getimagesize