Handling JPEG metadata with PHP

Sebastian Delmont has written a new class to handle JPEG metadata including EXIF and IPTC [1].

require_once \’Image/JPEG.php\’;

$jpeg =& new JPEGInfo(\’images/photos001.jpg\’);

echo $jpeg->getExifField(\”ApertureValue\”);
echo $jpeg->getIPTCField(\”Caption\”);

$jpeg->setIPTCField(\”Byline\”, \”Sebastian Delmont\”);
$jpeg->save(\”images/photos001-bis.jpg\”);

$info = $jpeg->getBasicInfo();
echo $info[\’Width\’] . \”x\” . $info[\’Height\’];

A similar package found already its way into PEAR lately [2].

[1] http://www.zonageek.com/tmp/JPEG.php.txt
[2] http://cvs.php.net/cvs.php/pear/Image_IPTC/

Leave a Reply