O'Reilly logo

Core PHP Programming, Third Edition by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Table 16.1. Image Types
ConstantDescriptionFile Extension
IMAGETYPE_BMPWindows Bitmap.bmp
IMAGETYPE_GIFGraphic Interchange Format.gif
IMAGETYPE_IFFInterchange Format Files.iff
IMAGETYPE_JB2Joint Bi-level Image Experts Group.jb2
IMAGETYPE_JP2JPEG 2000.jp2
IMAGETYPE_JPCJPEG 2000.jpc
IMAGETYPE_JPEGJoint Photographic Experts Group.jpg
IMAGETYPE_JPXJPEG 2000.jpx
IMAGETYPE_PNGPortable Network Graphics.png
IMAGETYPE_PSDAdobe Photoshop.psd
IMAGETYPE_SWCMacroMedia ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required