FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

php image exif functions

 


inet
Many image formats, especially JPEG, provide the ability to store textual (& binary thumbnail) metadata within the file itself. Digital cameras, scanners and other imaging equipment will often generate technical data and store it in a image more or less standard format know as the Exchangeable Image File Format or EXIF. Details can be found at http://www.exif.org/

if PHP has been compiled with --enable-exif, several functions become available to read EXIF data. Since EXIF data is related to the generation of image (see the example below), there is no need to write EXIF data, and none are provided.

int exif_imageType ( string filename )
Reads the first bytes of an image and checks its signature. When a correct signature is found a constant will be returned otherwise the return value is FALSE. The return value is the same value that getImageSize() returns in index 2 but this function is much faster.

int exif_read_data ( string filename [, string sections [, bool arrays [, bool thumbnail]]]
Reads the EXIF headers from a JPEG or TIFF image file. It returns an associative array where the indexes are the header names and the values are the values associated with those headers. If no data can be returned the result is FALSE.
filename is the name of the file to read. This cannot be an url.
sections is a comma separated list of sections that need to be present in file to produce a result array
arrays specifies whether or not each section becomes an array. The sections FILE, COMPUTED and THUMBNAIL allways become arrays as they may contain values whose names are conflict with other sections.
thumbnail whether or not to read the thumbnail itself and not only its tagged data.

int read_exif_data -- Alias of exif_read_data()

int exif_thumbnail ( string filename [, int &width [, int &height [, int &imagetype]]] )
Reads the embedded thumbnail of a TIFF or JPEG image. If the image contains no thumbnail FALSE will be returned.
The parameters width, height and imagetype are available since PHP 4.3.0 and return the size of the thumbnail as well as its type. It is possible that exif_thumbnail() cannot create an image but can determine its size. In this case, the return value is FALSE but width and height are set.
If you want to deliver thumbnails through this function, you should send the mimetype information using the header() function.
Reply to topic    Frihost Forum Index -> Miscellaneous -> Tutorials

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.