When you add a caption to an image in Google's Picasa/Picasa2 (and some other image editing programs) the caption is saved in a special spot in the imaged header section called IPTC data.
What is IPTC?
IPTC stands for International Press Telecommunications Council and is a defined set of medadata mainly used in news organizations for copyright proposes.
Basically its a standard set of attributes for an image.
Some of the attributes that are included in this standard are; datesent, timesent, objectname, editstatus, urgency, category, subcategory, fixture, keyword, reldate, reltime, specinstr, credate, cretime, orgprg, prgver, byline, bytitle, city, sublocation, state, countrycode, countryname, orgtransref, headline, credit, source, copyright, contact, caption, captionwriter, imagetype, orientation, language, subfile, appreserve. for a full list see the REF document on IPTC.
How to I extract IPTC information from an image?
Extracting and altering IPTC information in PHP is very simple with IPTCParse() and IPTCEmbed()
Example: View all available IPCT Data
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>';
}
}
}
}