16.1. Analyzing Images
These functions read information from images.
integer exif_imagetype(string file)
The exif_imagetype function reads the first few bytes of an image file and returns the type as an integer. Table 16.1 lists image types recognized. If PHP cannot determine the type, it returns FALSE.
Constant | Description | File Extension |
---|---|---|
IMAGETYPE_BMP | Windows Bitmap | .bmp |
IMAGETYPE_GIF | Graphic Interchange Format | .gif |
IMAGETYPE_IFF | Interchange Format Files | .iff |
IMAGETYPE_JB2 | Joint Bi-level Image Experts Group | .jb2 |
IMAGETYPE_JP2 | JPEG 2000 | .jp2 |
IMAGETYPE_JPC | JPEG 2000 | .jpc |
IMAGETYPE_JPEG | Joint Photographic Experts Group | .jpg |
IMAGETYPE_JPX | JPEG 2000 | .jpx |
IMAGETYPE_PNG | Portable Network Graphics | .png |
IMAGETYPE_PSD | Adobe Photoshop | .psd |
IMAGETYPE_SWC | MacroMedia ... |
Get Core PHP Programming, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.