2

I have some struggles to get the "Title" tag from a JPG file with PHP. I guess I'm looking through the wrong EXIF group. I'm using following code:

$exif = exif_read_data( $image['temp_name'], 0, true);
$exif_description = $exif['IFD0']['ImageDescription'];
$exif_title = $exif['WINXP']['Title'];
$exif_iso = $exif['EXIF']['ISOSpeedRatings'];

I looked through some specs of EXIF tags, but I always come up with "XPTitle" as the title. I'm not using Windows. It's hard to believe that it's the only available tag to store the title of the image as it involves changing the encoding. Can someone point me to get the proper title?

Edit:

I figured out it is included in the IPTC metadata which can be read in the following way:

output_iptc_data($bild);

function output_iptc_data( $image_path ) {
    $size = getimagesize ( $image_path, $info);
    if(is_array($info)) {
        $iptc = iptcparse($info["APP13"]);
        foreach (array_keys($iptc) as $s) {
            $c = count ($iptc[$s]);
            for ($i=0; $i <$c; $i++)
            {
                echo $s.' = '.$iptc[$s][$i].'<br>';
            }
        }
    }
}

If someone has a hint to improve this or figure it out through a different way, please feel free to give a hint or two. :P

AmigoJack
  • 5,234
  • 1
  • 15
  • 31
Alx
  • 6,275
  • 7
  • 32
  • 54
  • thx for the hint, unfortunately the field I'm searching for are not included. – Alx Dec 11 '11 at 19:16
  • The solution is "[ImageDescription](https://exiv2.org/tags.html)", because that's the EXIF tag that is meant as a title. See [this answer](https://stackoverflow.com/a/13573645/4299358). – AmigoJack Apr 17 '22 at 17:56
  • Appreciate the update, looks like there had been a few updates since the original question came up! – Alx Apr 23 '22 at 18:42

0 Answers0