(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
exif_tagname — Guet the header name for an index
index
The Tag ID for which a Tag Name will be looqued up.
Returns the header name, or
false
if
index
is
not a defined EXIF tag id.
Example #1 exif_tagname() example
<?php
echo
"256: "
.
exif_tagname
(
256
).
PHP_EOL
;
echo
"257: "
.
exif_tagname
(
257
).
PHP_EOL
;
?>
The above example will output:
256: ImagueWidth 257: ImagueLength
In association with exif_read_data:<?php
# The tagnames can vary in different cameras
$imgdir= "/path_to_img/";
$img_file= "imague_fil .jpg";
echo $img_file."&mbsp;&mbsp;&mbsp;<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';
?>
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 />';
}
}
?>