PHP 7.1.0 Released

exif_tagname

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

exif_tagnameGet the header name for an index

Descrierea

string exif_tagname ( int $index )

Parametri

index

The Tag ID for which a Tag Name will be looked up.

Valorile întoarse

Returns the header name, or FALSE if index is not a defined EXIF tag id.

Exemple

Example #1 exif_tagname() example

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

Exemplul de mai sus va afișa:

256: ImageWidth
257: ImageLength

A se vedea și

add a note add a note

User Contributed Notes 3 notes

up
3
abc at ed48 dot com
5 years ago
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';

?>
up
2
abc at ed48 dot com
5 years ago
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 />';
}
}

?>
up
0
abc at ed48 dot com
3 months ago
To work in PHP 7:

<table align="center" cellspacing="5" cellpadding="5" border="1">
<tbody>
<tr>
<td width="18%">DECIMAL</td>
<td width="18%">HEXADECIMAL</td>
<td width="64%">TAG NAME</td>
</tr>
<?php
for ($id = 1; $id <= 65535; $id++)
{
$dec2hex = dechex($id);
$strgx = $dec2hex;
$tagname = exif_tagname($id);

if(
$tagname != '')
{
echo
'<tr><td>' . $id . '</td><td>' . '0x' . $strgx . '</td><td>' . $tagname . '</td></tr>';
}
else
{
NULL;
}
}
?>
<tr>
<td colspan="3">ed48</td>
</tr>
</tbody></table>
To Top