コード例 #1
0
ファイル: Example.php プロジェクト: cyberorca/dfp-api
        <BR>
        <HR>
        <BR>

        Output the EXIF Information -->
        <?php 
echo Interpret_EXIF_to_HTML(get_EXIF_JPEG($filename), $filename);
?>

        <BR>
        <HR>
        <BR>

        Output the XMP Information -->
        <?php 
echo Interpret_XMP_to_HTML(read_XMP_array_from_text(get_XMP_text($jpeg_header_data)));
?>

        <BR>
        <HR>
        <BR>

        Output the Photoshop IRB (including the IPTC-NAA info -->
        <?php 
echo Interpret_IRB_to_HTML(get_Photoshop_IRB($jpeg_header_data), $filename);
?>

        <BR>
        <HR>
        <BR>
コード例 #2
0
 function interpretIFD($ifd_data)
 {
     // Check that the IFD array is valid
     if ($ifd_data === false || $ifd_data === null) {
         // the IFD array is NOT valid - exit
         return null;
     }
     $ifd_interpreted = array();
     // Cycle through each tag in the IFD
     foreach ($ifd_data as $tagid => $exif_tag) {
         // Ignore the non numeric elements - they aren't tags
         if (!is_numeric($tagid)) {
             // Skip Tags Name
         } else {
             if ($exif_tag['Decoded'] == true) {
                 // Check if the Tag has been decoded successfully
                 // This tag has been successfully decoded
                 // Check if the tag is a sub-IFD
                 if ($exif_tag['Type'] == "SubIFD") {
                     // This is a sub-IFD tag
                     // Add a sub-heading for the sub-IFD
                     $ifd_interpreted[$exif_tag['Tag Name']] = array();
                     // Cycle through each sub-IFD in the chain
                     foreach ($exif_tag['Data'] as $subIFD) {
                         // Interpret this sub-IFD and add the html to the secondary output
                         $ifd_interpreted[$exif_tag['Tag Name']][] = zmgJpeg_metadataPlugin::interpretIFD($subIFD, $filename);
                     }
                 } else {
                     if ($exif_tag['Type'] == "Maker Note") {
                         // Check if the tag is a makernote
                         // This is a Makernote Tag
                         // Interpret the Makernote and add the html to the secondary output
                         $ifd_interpreted['Makernote'] = Interpret_Makernote_to_HTML($exif_tag, $filename);
                     } else {
                         if ($exif_tag['Type'] == "IPTC") {
                             // Check if this is a IPTC/NAA Record within the EXIF IFD
                             // This is a IPTC/NAA Record, interpret it
                             $ifd_interpreted['IPTC'] = Interpret_IPTC_to_HTML($exif_tag['Data']);
                         } else {
                             if ($exif_tag['Type'] == "XMP") {
                                 // Change: Check for embedded XMP as of version 1.11
                                 // Check if this is a XMP Record within the EXIF IFD
                                 // This is a XMP Record, interpret it
                                 $ifd_interpreted['XMP'] = Interpret_XMP_to_HTML($exif_tag['Data']);
                             } else {
                                 if ($exif_tag['Type'] == "IRB") {
                                     // Change: Check for embedded IRB as of version 1.11
                                     // Check if this is a Photoshop IRB Record within the EXIF IFD
                                     // This is a Photoshop IRB Record, interpret it and output to the secondary html
                                     $ifd_interpreted['IRB'] = Interpret_IRB_to_HTML($exif_tag['Data'], $filename);
                                 } else {
                                     if ($exif_tag['Type'] == "Numeric") {
                                         // Check if the tag is Numeric
                                         // Numeric Tag - Output text value as is.
                                         $ifd_interpreted[$exif_tag['Tag Name']] = $exif_tag['Text Value'];
                                     } else {
                                         // Other tag - Output text as preformatted
                                         //$ifd_interpreted[$exif_tag['Tag Name']] = trim($exif_tag['Text Value']);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $ifd_interpreted;
 }
コード例 #3
0
ファイル: EXIF.php プロジェクト: evanhunter/PJMT
function interpret_IFD($IFD_array, $filename)
{
    // Create the output string with the table tag
    $output_str = "<table class=\"EXIF_Table\" border=1>\n";
    // Create an extra output string to receive any supplementary html
    // which cannot go inside the table
    $extra_IFD_str = "";
    // Check that the IFD array is valid
    if ($IFD_array === FALSE || $IFD_array === NULL) {
        // the IFD array is NOT valid - exit
        return "";
    }
    // Check if this is an EXIF IFD and if there is a makernote present
    if ($IFD_array['Tags Name'] === "EXIF" && !array_key_exists(37500, $IFD_array)) {
        // This is an EXIF IFD but NO makernote is present - Add a message to the output
        $extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">No Makernote Present</h3>";
    }
    // Cycle through each tag in the IFD
    foreach ($IFD_array as $Tag_ID => $Exif_Tag) {
        // Ignore the non numeric elements - they aren't tags
        if (!is_numeric($Tag_ID)) {
            // Skip Tags Name
        } else {
            if ($Exif_Tag['Decoded'] == TRUE) {
                // This tag has been successfully decoded
                // Table cells won't get drawn with nothing in them -
                // Ensure that at least a non breaking space exists in them
                if (trim($Exif_Tag['Text Value']) == "") {
                    $Exif_Tag['Text Value'] = "&nbsp;";
                }
                // Check if the tag is a sub-IFD
                if ($Exif_Tag['Type'] == "SubIFD") {
                    // This is a sub-IFD tag
                    // Add a sub-heading for the sub-IFD
                    $extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">" . $Exif_Tag['Tag Name'] . " contents</h3>";
                    // Cycle through each sub-IFD in the chain
                    foreach ($Exif_Tag['Data'] as $subIFD) {
                        // Interpret this sub-IFD and add the html to the secondary output
                        $extra_IFD_str .= interpret_IFD($subIFD, $filename);
                    }
                } else {
                    if ($Exif_Tag['Type'] == "Maker Note") {
                        // This is a Makernote Tag
                        // Add a sub-heading for the Makernote
                        $extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Maker Note Contents</h3>";
                        // Interpret the Makernote and add the html to the secondary output
                        $extra_IFD_str .= Interpret_Makernote_to_HTML($Exif_Tag, $filename);
                    } else {
                        if ($Exif_Tag['Type'] == "IPTC") {
                            // This is a IPTC/NAA Record, interpret it and output to the secondary html
                            $extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Contains IPTC/NAA Embedded in EXIF</h3>";
                            $extra_IFD_str .= Interpret_IPTC_to_HTML($Exif_Tag['Data']);
                        } else {
                            if ($Exif_Tag['Type'] == "XMP") {
                                // This is a XMP Record, interpret it and output to the secondary html
                                $extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Contains XMP Embedded in EXIF</h3>";
                                $extra_IFD_str .= Interpret_XMP_to_HTML($Exif_Tag['Data']);
                            } else {
                                if ($Exif_Tag['Type'] == "IRB") {
                                    // This is a Photoshop IRB Record, interpret it and output to the secondary html
                                    $extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Contains Photoshop IRB Embedded in EXIF</h3>";
                                    $extra_IFD_str .= Interpret_IRB_to_HTML($Exif_Tag['Data'], $filename);
                                } else {
                                    if ($Exif_Tag['Type'] == "Numeric") {
                                        // Numeric Tag - Output text value as is.
                                        $output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\">" . $Exif_Tag['Text Value'] . "</td></tr>\n";
                                    } else {
                                        // Other tag - Output text as preformatted
                                        $output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\"><pre>" . trim($Exif_Tag['Text Value']) . "</pre></td></tr>\n";
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                // Tag has NOT been decoded successfully
                // Hence it is either an unknown tag, or one which
                // requires processing at the time of html construction
                // Table cells won't get drawn with nothing in them -
                // Ensure that at least a non breaking space exists in them
                if (trim($Exif_Tag['Text Value']) == "") {
                    $Exif_Tag['Text Value'] = "&nbsp;";
                }
                // Check if this tag is the first IFD Thumbnail
                if ($IFD_array['Tags Name'] == "TIFF" && $Tag_ID == 513) {
                    // This is the first IFD thumbnail - Add html to the output
                    // Change: as of version 1.11 - Changed to make thumbnail link portable across directories
                    // Build the path of the thumbnail script and its filename parameter to put in a url
                    $link_str = get_relative_path(dirname(__FILE__) . "/get_exif_thumb.php", getcwd());
                    $link_str .= "?filename=";
                    $link_str .= get_relative_path($filename, dirname(__FILE__));
                    // Add thumbnail link to html
                    $output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\"><a class=\"EXIF_First_IFD_Thumb_Link\" href=\"{$link_str}\"><img class=\"EXIF_First_IFD_Thumb\" src=\"{$link_str}\"></a></td></tr>\n";
                } else {
                    if ($Exif_Tag['Type'] == "Maker Note") {
                        // This is the makernote, but has not been decoded
                        // Add a message to the secondary output
                        $extra_IFD_str .= "<h3 class=\"EXIF_Secondary_Heading\">Makernote Coding Unknown</h3>\n";
                    } else {
                        // This is an Unknown Tag
                        // Check if the user wants to hide unknown tags
                        if ($GLOBALS['HIDE_UNKNOWN_TAGS'] === FALSE) {
                            // User wants to display unknown tags
                            // Check if the Data is an ascii string
                            if ($Exif_Tag['Data Type'] == 2) {
                                // This is a Ascii String field - add it preformatted to the output
                                $output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\"><pre>" . trim($Exif_Tag['Text Value']) . "</pre></td></tr>\n";
                            } else {
                                // Not an ASCII string - add it as is to the output
                                $output_str .= "<tr class=\"EXIF_Table_Row\"><td class=\"EXIF_Caption_Cell\">" . $Exif_Tag['Tag Name'] . "</td><td class=\"EXIF_Value_Cell\">" . trim($Exif_Tag['Text Value']) . "</td></tr>\n";
                            }
                        }
                    }
                }
            }
        }
    }
    // Close the table in the output
    $output_str .= "</table>\n";
    // Add the secondary output at the end of the main output
    $output_str .= "{$extra_IFD_str}\n";
    // Return the resulting html
    return $output_str;
}