91        'Iptc4xmpCore:CiAdrCity',
 
   92        'Iptc4xmpCore:CiAdrCtry',
 
   93        'Iptc4xmpCore:CiAdrExtadr',
 
   94        'Iptc4xmpCore:CiAdrPcode',
 
   95        'Iptc4xmpCore:CiAdrRegion',
 
   96        'Iptc4xmpCore:CiEmailWork',
 
   97        'Iptc4xmpCore:CiTelWork',
 
   98        'Iptc4xmpCore:CiUrlWork',
 
   99        'Iptc4xmpCore:CountryCode',
 
  100        'Iptc4xmpCore:CreatorContactInfo',
 
  101        'Iptc4xmpCore:IntellectualGenre',
 
  102        'Iptc4xmpCore:Location',
 
  103        'Iptc4xmpCore:Scene',
 
  104        'Iptc4xmpCore:SubjectCode',
 
  135        'xmpRights:Certificate',
 
  138        'xmpRights:UsageTerms',
 
  139        'xmpRights:WebStatement',
 
  152        'xapRights:Certificate',
 
  153        'xapRights:Copyright',
 
  156        'xapRights:UsageTerms',
 
  157        'xapRights:WebStatement',
 
  167        'xapMM:ManagerVariant',
 
  168        'xapMM:RenditionClass',
 
  169        'xapMM:RenditionParams',
 
  178        'xmpTPg:MaxPageSize',
 
  188        'photoshop:AuthorsPosition',
 
  189        'photoshop:CaptionWriter',
 
  190        'photoshop:Category',
 
  194        'photoshop:DateCreated',
 
  195        'photoshop:Headline',
 
  198        'photoshop:Instructions',
 
  201        'photoshop:SupplementalCategories',
 
  202        'photoshop:TransmissionReference',
 
  207        'tiff:BitsPerSample',
 
  209        'tiff:PhotometricInterpretation',
 
  211        'tiff:SamplesPerPixel',
 
  212        'tiff:PlanarConfiguration',
 
  213        'tiff:YCbCrSubSampling',
 
  214        'tiff:YCbCrPositioning',
 
  217        'tiff:ResolutionUnit',
 
  218        'tiff:TransferFunction',
 
  220        'tiff:PrimaryChromaticities',
 
  221        'tiff:YCbCrCoefficients',
 
  222        'tiff:ReferenceBlackWhite',
 
  224        'tiff:ImageDescription',
 
  231        'exif:FlashpixVersion',
 
  233        'exif:ComponentsConfiguration',
 
  234        'exif:CompressedBitsPerPixel',
 
  235        'exif:PixelXDimension',
 
  236        'exif:PixelYDimension',
 
  239        'exif:RelatedSoundFile',
 
  240        'exif:DateTimeOriginal',
 
  241        'exif:DateTimeDigitized',
 
  244        'exif:ExposureProgram',
 
  245        'exif:SpectralSensitivity',
 
  246        'exif:ISOSpeedRatings',
 
  248        'exif:ShutterSpeedValue',
 
  249        'exif:ApertureValue',
 
  250        'exif:BrightnessValue',
 
  251        'exif:ExposureBiasValue',
 
  252        'exif:MaxApertureValue',
 
  253        'exif:SubjectDistance',
 
  260        'exif:SpatialFrequencyResponse',
 
  261        'exif:FocalPlaneXResolution',
 
  262        'exif:FocalPlaneYResolution',
 
  263        'exif:FocalPlaneResolutionUnit',
 
  264        'exif:SubjectLocation',
 
  265        'exif:SensingMethod',
 
  269        'exif:CustomRendered',
 
  272        'exif:DigitalZoomRatio',
 
  273        'exif:FocalLengthIn35mmFilm',
 
  274        'exif:SceneCaptureType',
 
  279        'exif:DeviceSettingDescription',
 
  280        'exif:SubjectDistanceRange',
 
  281        'exif:ImageUniqueID',
 
  285        'exif:GPSAltitudeRef',
 
  288        'exif:GPSSatellites',
 
  290        'exif:GPSMeasureMode',
 
  296        'exif:GPSImgDirectionRef',
 
  297        'exif:GPSImgDirection',
 
  299        'exif:GPSDestLatitude',
 
  300        'exif:GPSDestLongitude',
 
  301        'exif:GPSDestBearingRef',
 
  302        'exif:GPSDestBearing',
 
  303        'exif:GPSDestDistanceRef',
 
  304        'exif:GPSDestDistance',
 
  305        'exif:GPSProcessingMethod',
 
  306        'exif:GPSAreaInformation',
 
  307        'exif:GPSDifferential',
 
  318        'stEvt:softwareAgent',
 
  323        'stRef:renditionClass',
 
  324        'stRef:renditionParams',
 
  326        'stRef:managerVariant',
 
  464        ignore_user_abort(
true);
 
  476        $data = fread($filehnd, 2);
 
  479        if (
$data != 
"\xFF\xD8") {
 
  481            echo 
'<p>This probably is not a JPEG file</p>'.
"\n";
 
  488        $data = fread($filehnd, 2);
 
  491        if (
$data{0} != 
"\xFF") {
 
  499        $hit_compressed_image_data = 
false;
 
  505        while ((
$data{1} != 
"\xD9") && (!$hit_compressed_image_data) && (!feof($filehnd))) {
 
  508            if ((ord(
$data{1}) < 0xD0) || (ord(
$data{1}) > 0xD7)) {
 
  511                $sizestr = fread($filehnd, 2);
 
  514                $decodedsize = unpack(
'nsize', $sizestr);
 
  517                $segdatastart = ftell($filehnd);
 
  520                $segdata = fread($filehnd, $decodedsize[
'size'] - 2);
 
  523                $headerdata[] = array(
 
  524                    'SegType'      => ord(
$data{1}),
 
  525                    'SegName'      => self::$JPEG_Segment_Names[ord(
$data{1})],
 
  526                    'SegDataStart' => $segdatastart,
 
  527                    'SegData'      => $segdata,
 
  532            if (
$data{1} == 
"\xDA") {
 
  534                $hit_compressed_image_data = 
true;
 
  537                $data = fread($filehnd, 2);
 
  540                if (
$data{0} != 
"\xFF") {
 
  552        ignore_user_abort(
false);
 
  571        for ($i = 0; $i < count($jpeg_header_data); $i++) {
 
  573            if (strcmp($jpeg_header_data[$i][
'SegName'], 
'APP1') == 0) {
 
  575                if (strncmp($jpeg_header_data[$i][
'SegData'], 
'http://ns.adobe.com/xap/1.0/'.
"\x00", 29) == 0) {
 
  578                    $xmp_data = substr($jpeg_header_data[$i][
'SegData'], 29);
 
  580                    return trim($xmp_data); 
 
  599        if (trim($xmltext) == 
'') {
 
  604        $xml_parser = xml_parser_create(
'UTF-8');
 
  611        if (xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 0) == 
false) {
 
  613            xml_parser_free($xml_parser);
 
  621        if (xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0) == 
false) {
 
  623            xml_parser_free($xml_parser);
 
  629        if (xml_parse_into_struct($xml_parser, $xmltext, $values, $tags) == 0) {
 
  631            xml_parser_free($xml_parser);
 
  637        xml_parser_free($xml_parser);
 
  640        $xmp_array = array();
 
  645        $current_property = 
''; 
 
  646        $container_index = -1; 
 
  647        foreach ($values as $xml_elem) {
 
  649            switch ($xml_elem[
'tag']) {
 
  658                case 'rdf:Description':
 
  659                    switch ($xml_elem[
'type']) {
 
  662                            if (array_key_exists(
'attributes', $xml_elem)) {
 
  664                                foreach (array_keys($xml_elem[
'attributes']) as $key) {
 
  666                                    if (in_array($key, self::$XMP_tag_captions)) {
 
  668                                        $xmp_array[$key] = $xml_elem[
'attributes'][$key];
 
  684                    if ($xml_elem[
'type'] == 
'complete') {
 
  685                        if (array_key_exists(
'attributes', $xml_elem)) {
 
  687                            if (isset($xml_elem[
'attributes'][
'xml:lang']) && ($xml_elem[
'attributes'][
'xml:lang'] != 
'x-default')) {
 
  691                        if ($current_property != 
'') {
 
  692                            $xmp_array[$current_property][$container_index] = (isset($xml_elem[
'value']) ? $xml_elem[
'value'] : 
'');
 
  693                            $container_index += 1;
 
  703                    switch ($xml_elem[
'type']) {
 
  705                             $container_index = 0;
 
  708                            $container_index = -1;
 
  717                    if (in_array($xml_elem[
'tag'], self::$XMP_tag_captions)) {
 
  718                        switch ($xml_elem[
'type']) {
 
  721                                $current_property = $xml_elem[
'tag'];
 
  726                                $current_property = 
'';
 
  731                                $xmp_array[$xml_elem[
'tag']] = (isset($xml_elem[
'value']) ? $xml_elem[
'value'] : 
'');
 
  754        $this->_sFilename = $sFilename;
 
  756        if (is_file($this->_sFilename)) {
 
  761                $this->_bXMPParse = 
true;
 
An exception for terminatinating execution or to throw for unit testing.
GetId3() by James Heinrich info@getid3.org //.
isValid()
Returns the status of XMP parsing during instantiation.
_get_jpeg_header_data($filename)
Reads all the JPEG header segments from an JPEG image file into an array.
Image_XMP($sFilename)
Constructor.
_get_XMP_text($filename)
Retrieves XMP information from an APP1 JPEG segment and returns the raw XML text as a string.
getAllTags()
Get a copy of all XMP tags extracted from the image.
static $JPEG_Segment_Names
read_XMP_array_from_text($xmltext)
Parses a string containing XMP data (XML), and returns an array which contains all the XMP (XML) info...