int Exif_imagetype (string $filename)
1 imagetype_gif
2 Imagetype_jpeg
3 Imagetype_png
4 imagetype_swf
5 Imagetype_ps Tutorial D
6 imagetype_bmp
7 Imagetype_tiff_ii (Intel byte order)
8 imagetype_tiff_mm (Motorola byte order)
9 IMAGETYPE_JPC
Ten IMAGETYPE_JP2
Imagetype_jpx
Imagetype_jb2
Imagetype_swc
Imagetype_iff
Imagetype_wbmp
Imagetype_xbm
*/
$img = "Image.gif"; Definition file
if (Exif_imagetype ($img)!=imagetype_gif)//Determine file type
{
echo "The specified picture is not a GIF image"; Output results
}
Else
{
echo "The specified picture is a GIF image";
}
/*
Array Exif_read_data (String $filename [, string $sections = null [, BOOL $arrays = False [, bool $thumbnail = false]]] )
*/
echo "Test1.jpg:
n "; Output file name
$exif =exif_read_data (' tests/test1.jpg ', ' ifd0 '); Read File 1 information
Judging by the results
Echo $exif ===false? "No header data found.
N ":" Image contains headers
n ";
$exif =exif_read_data (' tests/test2.jpg ', 0,true); Read File 2 information
echo "Test2.jpg:
n "; Output file name
foreach ($exif as $key + $section)//cyclic read information
{
foreach ($section as $name = $val)
{
echo "$key. $name: $val
n ";
}
}
/*
Test1.jpg:
No header data found.
Test2.jpg:
File.filename:test2.jpg
file.filedatetime:1017666176
file.filesize:1240
File.filetype:2
File.sectionsfound:any_tag, ifd0, thumbnail, comment
Computed.html:width= "1" height= "1"
Computed.height:1
Computed.width:1
Computed.iscolor:1
Computed.byteordermotorola:1
Computed.usercomment:exif test Image.
Computed.usercommentencoding:ascii
Computed.copyright:photo (c) M.boerger, edited by M.boerger.
Computed.copyright.photographer:photo (c) M.boerger
Computed.copyright.editor:edited by M.boerger.
Ifd0.copyright:photo (c) M.boerger
Ifd0.usercomment:ascii
thumbnail.jpeginterchangeformat:134
thumbnail.jpeginterchangeformatlength:523
Comment.0:comment #1.
Comment.1:comment #2.
Comment.2:comment #3end
thumbnail.jpeginterchangeformat:134
Thumbnail.thumbnail.height:1
Thumbnail.thumbnail.height:1
//*/
$index = "1"; Defining indexes
$string =exif_tagname ($index); Get header information for an image index
Echo $string; Output results
//
if (array_key_exists (' file ', $_request))
{
$image =exif_thumbnail ($_request[' file '), $width, $height, $type); Get thumbnail images of files
}
else//If the array does not have a corresponding key value
{
$image =false; return error
}
if ($image!==false)//returns True
{
Header ("Content-type:". Image_type_to_mime_type ($type)); Send header File
Echo $image; Output thumbnail image
Exit End PHP Tutorial Code
}
else//If an error is returned
{
echo "no thumbnail available"; Output information
}
http://www.bkjia.com/PHPjc/632997.html www.bkjia.com true http://www.bkjia.com/PHPjc/632997.html techarticle int Exif_imagetype (string $filename) 1 imagetype_gif 2 imagetype_jpeg 3 imagetype_png 4 imagetype_swf 5 imagetype_p S Tutorial d 6 imagetype_bmp 7 Imagetype_tiff_ii (Intel byte order ...