php教程

exif_tagname

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

exif_tagname获取指定索引的头名称

说明

exif_tagname ( int $index ) : string

参数

index

要查找的标签名称的 ID。

返回值

返回头名称。 如果 index 参数不是预定义的 EXIF 标签 id,则返回 FALSE

范例

Example #1 exif_tagname() 函数例程

<?php
echo "256: ".exif_tagname(256).PHP_EOL;
echo 
"257: ".exif_tagname(257).PHP_EOL;
?>

以上例程会输出:

256: ImageWidth
257: ImageLength

参见

User Contributed Notes

abc at ed48 dot com 22-Jun-2011 10:03
In association with exif_read_data:

<?php

# The tagnames can vary in different cameras

$imgdir = "/path_to_img/";
$img_file = "image_file.jpg";

echo
$img_file . "&nbsp;&nbsp;&nbsp;<sub>TEST</sub>
<br />"
;
echo
'<img src="' . $imgdir . $img_file . '" alt="'
 
. $img_file . '" title="' . $img_file . '" width="400" /><br /><br />';

$xf_data = exif_read_data($imgdir . $img_file);

$tagg = exif_tagname(0X10F);
echo
'<br>' . $tagg ' >>> ' . $xf_data[$tagg];
$tagg = exif_tagname(0X110);
echo
'<br>' . $tagg ' >>> ' . $xf_data[$tagg];
$tagg = exif_tagname(0X132);
echo
'<br>' . $tagg ' >>> ' . $xf_data[$tagg];
$tagg = exif_tagname(0XA002);
echo
'<br>' . $tagg ' >>> ' . $xf_data[$tagg] . 'px';
$tagg = exif_tagname(0XA003);
echo
'<br>' . $tagg ' >>> ' . $xf_data[$tagg] . 'px';

?>
abc at ed48 dot com 21-Jun-2011 01:20
Theoretically, 65,535 tags are possible. Although not all are used, yet. The code below lists these tags:

<?php

for ($id = 1; $id <= 65535; $id++)
{
$dec2hex = dechex($id);

$strgx = '0x'. $dec2hex;

if(
exif_tagname($strgx) != "")
{
echo
$strgx . ' ( ' . exif_tagname($strgx) . ' )<br />';
}
}

?>

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788