exif是一个读取图片meta data的扩展,可以很好的读取相机拍摄的照片.
支持以下方法:
int exif_imagetype ( string $filename )
判断一个图像的类型。可能返回的值包括:IMAGETYPE_GIF,IMAGETYPE_JPEG,IMAGETYPE_PNG,IMAGETYPE_BMP等常量.
if (exif_imagetype(“image.gif”) != IMAGETYPE_GIF) {
echo “The picture is not a gif”;
}
array exif_read_data ( string $filename [, string $sections = NULL [, bool $arrays = false [, bool $thumbnail = false ]]] )
从 JPEG 或 TIFF 图像文件中读取 EXIF 头信息。这样就可以读取数码相机产生的元数据.EXIF 头信息往往存在于数码相机生成的 JPEG/TIFF 图像中,但不幸的是每个数码相机制造商的标记都不同,因此(编写代码时)不能依赖于某个特定的 Exif 头信息
$exif = exif_read_data(‘tests/test2.jpg’, 0, true);
echo “test.jpg:<br />\n”;
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo “$key.$name: $val<br />\n”;
}
}
结果类似如下:
test.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
string exif_tagname ( int $index )
根据索引得到头信息名称
echo “256: “.exif_tagname(256).PHP_EOL;
echo “257: “.exif_tagname(257).PHP_EOL;
输出:
256: ImageWidth
257: ImageLength
string exif_thumbnail ( string $filename [, int &$width [, int &$height [, int &$imagetype ]]] )
取得嵌入在 TIFF 或 JPEG 图像中的缩略图
if (array_key_exists(‘file’,$_REQUEST)) {
$image = exif_thumbnail($_REQUEST['file'], $width, $height, $type);
} else {
$image = false;
}
if ($image!==false) {
header(“Content-type: “.image_type_to_mime_type($type));
echo $image;
exit;
} else {
// no thumbnail available, handle the error here
echo “No thumbnail available”;
}
If totes are your style then Belvah has just the thing for you
snooki weight loss Refurbished but Authentic Chanel Designer Handbags especially for winter and fall
quick weight lossSuperheroes save summer box office