You can use
iptcembed to embed binary IPTC data into a JPEG image
exif-read-data to read the EXIF headers from JPEG or TIFF
How to read a Title tag from a JPEG file
getimagesize('./phplogo.jpg', $info);
$title = '';
if (isset($info["APP13"])) {
$iptc = iptcparse ($info["APP13"]);
$title = (isset($iptc["2#085"][0])) ? $iptc["2#085"][0] : NULL;
}
print $title;
How to add Title tag to a JPEG
Notes: You have only to manipulate $iptc array and to specify to file path
this is a working example from iptcembed
// iptc_make_tag() function by Thies C. Arntzen
function iptc_make_tag($rec, $data, $value)
{
$length = strlen($value);
$retval = chr(0x1C) . chr($rec) . chr($data);
if($length < 0x8000)
{
$retval .= chr($length >> 8) . chr($length & 0xFF);
}
else
{
$retval .= chr(0x80) .
chr(0x04) .
chr(($length >> 24) & 0xFF) .
chr(($length >> 16) & 0xFF) .
chr(($length >> 8) & 0xFF) .
chr($length & 0xFF);
}
return $retval . $value;
}
// Path to jpeg file
$path = './phplogo.jpg';
// Set the IPTC tags
$iptc = array(
'2#085' => 'Anis TITLE'
);
// Convert the IPTC tags into binary code
$data = '';
foreach($iptc as $tag => $string)
{
$tag = substr($tag, 2);
$data .= iptc_make_tag(2, $tag, $string);
}
// Embed the IPTC data
$content = iptcembed($data, $path);
// Write the new image data out to the file.
$fp = fopen($path, "wb");
fwrite($fp, $content);
fclose($fp);
Here the complet list of IPTC indexes
DEFINE('IPTC_OBJECT_NAME', '2#005');
DEFINE('IPTC_EDIT_STATUS', '2#007');
DEFINE('IPTC_PRIORITY', '2#010');
DEFINE('IPTC_CATEGORY', '2#015');
DEFINE('IPTC_SUPPLEMENTAL_CATEGORY', '2#020');
DEFINE('IPTC_FIXTURE_IDENTIFIER', '2#022');
DEFINE('IPTC_KEYWORDS', '2#025');
DEFINE('IPTC_RELEASE_DATE', '2#030');
DEFINE('IPTC_RELEASE_TIME', '2#035');
DEFINE('IPTC_SPECIAL_INSTRUCTIONS', '2#040');
DEFINE('IPTC_REFERENCE_SERVICE', '2#045');
DEFINE('IPTC_REFERENCE_DATE', '2#047');
DEFINE('IPTC_REFERENCE_NUMBER', '2#050');
DEFINE('IPTC_CREATED_DATE', '2#055');
DEFINE('IPTC_CREATED_TIME', '2#060');
DEFINE('IPTC_ORIGINATING_PROGRAM', '2#065');
DEFINE('IPTC_PROGRAM_VERSION', '2#070');
DEFINE('IPTC_OBJECT_CYCLE', '2#075');
DEFINE('IPTC_BYLINE', '2#080');
DEFINE('IPTC_BYLINE_TITLE', '2#085');
DEFINE('IPTC_CITY', '2#090');
DEFINE('IPTC_PROVINCE_STATE', '2#095');
DEFINE('IPTC_COUNTRY_CODE', '2#100');
DEFINE('IPTC_COUNTRY', '2#101');
DEFINE('IPTC_ORIGINAL_TRANSMISSION_REFERENCE', '2#103');
DEFINE('IPTC_HEADLINE', '2#105');
DEFINE('IPTC_CREDIT', '2#110');
DEFINE('IPTC_SOURCE', '2#115');
DEFINE('IPTC_COPYRIGHT_STRING', '2#116');
DEFINE('IPTC_CAPTION', '2#120');
DEFINE('IPTC_LOCAL_CAPTION', '2#121');