Example #1
0
function get_EXIF_TIFF($filename)
{
    // Change: Added as of version 1.11
    // Check if a wrapper is being used - these are not currently supported (see notes at top of file)
    if (stristr($filename, "http://") != FALSE || stristr($filename, "ftp://") != FALSE) {
        // A HTTP or FTP wrapper is being used - show a warning and abort
        echo "HTTP and FTP wrappers are currently not supported with TIFF - See EXIF/TIFF functionality documentation - a local file must be specified<br>";
        echo "To work on an internet file, copy it locally to start with:<br><br>\n";
        echo "\$newfilename = tempnam ( \$dir, \"tmptiff\" );<br>\n";
        echo "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
        return FALSE;
    }
    $filehnd = @fopen($filename, 'rb');
    // Check if the file opened successfully
    if (!$filehnd) {
        // Could't open the file - exit
        echo "<p>Could not open file {$filename}</p>\n";
        return FALSE;
    }
    // Decode the Exif segment into an array and return it
    $exif_data = process_TIFF_Header($filehnd, "TIFF");
    // Close File
    fclose($filehnd);
    return $exif_data;
}
function get_Nikon_Makernote($Makernote_Tag, $EXIF_Array, $filehnd, $Make_Field)
{
    // Check if the Make Field contains the word Nikon
    if (stristr($Make_Field, "Nikon") === FALSE) {
        // Nikon not found in maker field - abort
        return FALSE;
    }
    // Check if the header exists at the start of the Makernote
    if (substr($Makernote_Tag['Data'], 0, 8) == "Nikon") {
        // Nikon Type 1 Makernote
        // Seek to the start of the IFD
        fseek($filehnd, $Makernote_Tag['Tiff Offset'] + $Makernote_Tag['Offset'] + 8);
        // Read the IFD(s) into an array
        $Makernote_Tag['Decoded Data'] = read_Multiple_IFDs($filehnd, $Makernote_Tag['Tiff Offset'], $Makernote_Tag['ByteAlign'], "Nikon Type 1");
        // Save some information into the Tag element to aid interpretation
        $Makernote_Tag['Decoded'] = TRUE;
        $Makernote_Tag['Makernote Type'] = "Nikon Type 1";
        $Makernote_Tag['Makernote Tags'] = "Nikon Type 1";
        // Return the new tag
        return $Makernote_Tag;
    } else {
        if (substr($Makernote_Tag['Data'], 0, 10) == "Nikon" || substr($Makernote_Tag['Data'], 0, 10) == "Nikon") {
            // Nikon Type 3 Makernote
            // Seek to the start of the IFD
            fseek($filehnd, $Makernote_Tag['Tiff Offset'] + $Makernote_Tag['Offset'] + 10);
            // Read the TIFF header and IFD(s) into an array
            $Makernote_Tag['Decoded Data'] = process_TIFF_Header($filehnd, "Nikon Type 3");
            // Save some information into the Tag element to aid interpretation
            $Makernote_Tag['Makernote Type'] = "Nikon Type 3";
            $Makernote_Tag['Makernote Tags'] = "Nikon Type 3";
            $Makernote_Tag['Decoded'] = TRUE;
            // Return the new tag
            return $Makernote_Tag;
        } else {
            if (substr($Makernote_Tag['Data'], 0, 8) == "FUJIFILM") {
                // Fuji Makernote - used by Nikon Coolpix 775
                // Let the Fujifilm library handle it
                return False;
            } else {
                // No header - Nikon Type 2
                // Seek to the start of the IFD
                fseek($filehnd, $Makernote_Tag['Tiff Offset'] + $Makernote_Tag['Offset'] + 0);
                // Read the IFD(s) into an array
                $Makernote_Tag['Decoded Data'] = read_Multiple_IFDs($filehnd, $Makernote_Tag['Tiff Offset'], $Makernote_Tag['ByteAlign'], "Nikon Type 3");
                // Save some information into the Tag element to aid interpretation
                $Makernote_Tag['Decoded'] = TRUE;
                $Makernote_Tag['Makernote Type'] = "Nikon Type 2";
                $Makernote_Tag['Makernote Tags'] = "Nikon Type 3";
                // Return the new tag
                return $Makernote_Tag;
            }
        }
    }
    // Shouldn't get here
    return FALSE;
}
Example #3
0
function get_EXIF_TIFF($filename)
{
    $filehnd = @fopen($filename, 'rb');
    // Check if the file opened successfully
    if (!$filehnd) {
        // Could't open the file - exit
        echo "<p>Could not open file {$filename}</p>\n";
        return FALSE;
    }
    // Decode the Exif segment into an array and return it
    $exif_data = process_TIFF_Header($filehnd, "TIFF");
    // Close File
    fclose($filehnd);
    return $exif_data;
}