コード例 #1
0
$vorname = $row['vorname'];
$name = $row['name'];
//$u_name = $row['username'];
$lang = $row['language'];
//Ermittlung aller writable gesetzten Tags in der exif_protect-Tabelle (Obermenge):
$result1 = mysql_query("SELECT * FROM {$table5} WHERE writable = '1'");
$num1 = mysql_num_rows($result1);
//echo $num1."<br>";
for ($i1 = '0'; $i1 < $num1; $i1++) {
    $field_name = mysql_result($result1, $i1, 'field_name');
    $writable_tags[$field_name] = $field_name;
}
//print_r($writable_tags);
echo "<FORM name='edit_details' method='post' action='save_meta_data_action.php'>\n\n\t<TABLE border = '0' style='width:450px;background-color:#FFFFFF' align = 'center'>\n\t<TR class='normal' style='height:3px;'>\n\t\t<TD class='normal' bgcolor='darkred' colspan = '2'>\n\t\t</TD>\n\t</TR>\n\t\n\t<TR class='normal'>\n\t\t<TD class='normal' colspan = '2'>\n\t\tAlle editierbaren Details zum Bild " . $pic_id . "\n\t\t</TD>\n\t</TR>\n\t\n\t<TR class='normal' style='height:3px;'>\n\t\t<TD class='normal' bgcolor='darkred' colspan = '2'>\n\t\t</TD>\n\t</TR>\n\t\n\t<TR class='normal' style='background-color:lightgreen;'>\n\t\t<TD class='normal' colspan = '2' align='left'>\n\t\t--- allgemeine Daten ----\n\t\t</TD>\n\t</TR>\n\t\n\t<TR style='background-color:#FFFFFF';>\n\t\t<TD class='liste2' style='width:225px;'>Original-Dateiname</TD>\n\t\t<TD class='liste2' style='width:225px;'>" . $FileNameOri . "</TD>\n\t</TR>\n\t\n\t<TR style='background-color:#DDDDDD';>\n\t\t<TD class='liste2' style='width:225px;'>Eigent&uuml;mer</TD>\n\t\t<TD class='liste2' style='width:225px;'>" . $vorname . " " . $name . "</TD>\n\t</TR>\n\t\n\t<TR class='normal' style='background-color:lightgreen;'>\n\t\t<TD class='normal' colspan = '2' align='left'>\n\t\t--- editierbare Daten ----\n\t\t</TD>\n\t</TR>";
//Ermittlung aller Tags in der Bild-Datei
$FN = strtolower($pic_path . "/" . restoreOriFilename($pic_id, $sr));
//echo $file."<BR>";
$exif_daten = shell_exec($exiftool . " -g -s -x 'Directory' " . $FN);
$info_arr = explode(chr(10), $exif_daten);
//Umschreibung des Info-Arrays in die Form Schluessel=$tag / Wert=$value
$INFO_ARR = array();
foreach ($info_arr as $IA) {
    $pos = strpos($IA, ':');
    $tag = trim(substr($IA, 0, $pos));
    $value = trim(substr($IA, $pos + 1));
    $INFO_ARR[$tag] = $value;
}
//print_r($INFO_ARR)."<BR>";
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$n = 0;
if (isset($writable_tags)) {
コード例 #2
0
function extractExifData($pic_id, $sr, $Orientation)
{
    include $sr . '/bin/share/global_config.php';
    include $sr . '/bin/share/db_connect1.php';
    $exiftool = buildExiftoolCommand($sr);
    $result6 = mysql_query("SELECT * FROM {$table14} WHERE pic_id = '{$pic_id}'");
    if (mysql_num_rows($result6) == 0) {
        //nur wenn es noch keinen Eintrag in der meta_data-Tabelle fuer dieses Bild gibt, wird die Erfassung ausgefuehrt:
        $result7 = mysql_query("INSERT INTO {$table14} (pic_id) VALUES ('{$pic_id}')");
        //Ermittlung des Original-Dateinamens mit eindeutiger Bezeichnung (z.B. 12345.nef):
        $FN = $pic_path . "/" . restoreOriFilename($pic_id, $sr);
        $result8 = mysql_query("SHOW COLUMNS FROM {$table14}");
        $i = 0;
        if ($result8 != false) {
            while ($liste = mysql_fetch_row($result8)) {
                $tab_fieldname[$i] = $liste[0];
                //vorh. Tabellen-Feldname
                $i++;
            }
        } else {
            die('Fehler bei der Datenbankabfrage');
        }
        // Fuer jedes Feld der Meta-Daten-Tabelle wird ein evtl. vorhandener Datenwert aus dem Bild
        // ausgelesen und in die Tabelle geschrieben:
        $text = shell_exec($exiftool . " " . $FN);
        $inf_arr = explode(chr(10), $text);
        //Zerlegung des Textes am Zeilenumbruch
        //echo count($inf_arr)." Meta-Angaben im Bild ".$FN."<BR><BR>";;
        foreach ($inf_arr as $IA) {
            $F_W = explode(' : ', $IA);
            //Zerlegung der Zeilen in Feld und Wert
            $fieldname = $F_W[0];
            //Bereinigung des Feldnamen:
            $fieldname = str_replace(" ", "", $fieldname);
            //Leerzeichen entfernen
            $fieldname = str_replace("/", "", $fieldname);
            //Schraegstriche entfernen
            $fieldname = str_replace("-", "_", $fieldname);
            //Bindestrich des Meta-Tags durch Unterstrich ersetzen, da Tabellen-Feldnamen nur Unterstriche aufweisen duerfen
            if (count($F_W) > 1) {
                $value = trim($F_W[1]);
            } else {
                $value = '';
            }
            if (in_array($fieldname, $tab_fieldname)) {
                //$value = formatValues($fieldname,$FN,$et_path);
                switch ($fieldname) {
                    case 'DateTimeOriginal':
                        $tmp_value = explode(" ", $value);
                        $value = str_replace(':', '-', $tmp_value[0]) . " " . $tmp_value[1];
                        break;
                    case 'FileSize':
                        $value = shell_exec($exiftool . " -FileSize -n " . $FN);
                        $fs_arr = explode(' : ', $value);
                        $value = trim($fs_arr[1]);
                        break;
                    case 'GPSLatitude':
                        $value = shell_exec($exiftool . " -c '%.11f' -GPSLatitude -n -s -s -s " . $FN);
                        break;
                    case 'GPSLongitude':
                        $value = shell_exec($exiftool . " -c '%.11f' -GPSLongitude -n -s -s -s " . $FN);
                        break;
                    case 'GPSAltitude':
                        $value = shell_exec($exiftool . " -c '%.11f' -GPSAltitude -n -s -s -s " . $FN);
                        break;
                }
                //echo ">>> Feld ".$fieldname." hat den Wert ".$value."<BR>";
                //Bildbreite- und Hoehe werden zur Sicherheit in 2 Felder (ExifImageHeight (Width) UND ImageHeight (WIdth)) geschrieben:
                if (($fieldname == 'ExifImageHeight' or $fieldname == 'ImageHeight') and ($value !== '0' and $value !== '')) {
                    $result4 = mysql_query("UPDATE {$table14} SET ExifImageHeight = '{$value}', ImageHeight = '{$value}' WHERE pic_id = '{$pic_id}'");
                } elseif (($fieldname == 'ExifImageWidth' or $fieldname == 'ImageWidth') and ($value !== '0' and $value !== '')) {
                    $result4 = mysql_query("UPDATE {$table14} SET ExifImageWidth = '{$value}', ImageWidth = '{$value}' WHERE pic_id = '{$pic_id}'");
                } elseif (($fieldname == 'ExifImageHeight' or $fieldname == 'ImageHeight' or $fieldname == 'ExifImageWidth' or $fieldname == 'ImageWidth') and ($value == '0' or $value == '')) {
                    //keine Aktualisierung!
                } else {
                    $value = utf8_decode($value);
                    $result4 = mysql_query("UPDATE {$table14} SET {$fieldname} = '{$value}' WHERE pic_id = '{$pic_id}'");
                    $statement = "UPDATE {$table14} SET {$fieldname} = '{$value}' WHERE pic_id = '{$pic_id}'";
                }
                if (mysql_error() !== '') {
                    echo "Fehler beim speichern der Meta-Daten (" . $fieldname . ", " . $value . ", " . $statement . "): " . mysql_error() . "<BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>";
                }
            }
        }
        // Wenn Breite, Hoehe oder Dateigroesse nicht aus den EXIF-Daten ermittelt werden konnte,
        // wird versucht, dies per PHP-Routinen zu erledigen:
        $result9 = mysql_query("SELECT * FROM {$table14} WHERE pic_id = '{$pic_id}'");
        $row = mysql_fetch_array($result9);
        $ImageWidth = $row['ImageWidth'];
        $ImageHeight = $row['ImageHeight'];
        $FileSize = $row['FileSize'];
        @($params = getimagesize($FN));
        $breite = $params[0];
        $hoehe = $params[1];
        clearstatcache();
        $FileSize = filesize($FN);
        //Dateigroesse der Originaldatei in Byte
        if ($ImageWidth == '0' or $ImageWidth == '') {
            $result10 = mysql_query("UPDATE {$table14} SET ImageWidth = '{$breite}' WHERE pic_id = '{$pic_id}'");
        }
        if ($ImageHeight == '0' or $ImageHeight == '') {
            $result11 = mysql_query("UPDATE {$table14} SET ImageHeight = '{$hoehe}' WHERE pic_id = '{$pic_id}'");
        }
        if ($FileSize == '0' or $FileSize == '') {
            $result12 = mysql_query("UPDATE {$table14} SET FileSize = '{$FileSize}' WHERE pic_id = '{$pic_id}'");
        }
        $result13 = mysql_query("UPDATE {$table14} SET Orientation = '{$Orientation}' WHERE pic_id = '{$pic_id}'");
        //echo mysql_error();
    }
    //Wenn alle Meta-Daten in table14 uebernommen wurden, wird geprueft, ob Geo-Koordinaten dabei waren.
    //Wenn ja, wird eine neue location angelegt (in table12) und diese mit dem Bild referenziert:
    $result14 = mysql_query("SELECT * FROM {$table14} WHERE pic_id = '{$pic_id}'");
    @($GPSLatitude = mysql_result($result14, 0, 'GPSLatitude'));
    @($GPSLongitude = mysql_result($result14, 0, 'GPSLongitude'));
    @($GPSAltitude = mysql_result($result14, 0, 'GPSAltitude'));
    if ($GPSLongitude !== NULL and $GPSLatitude !== NULL) {
        $result15 = mysql_query("INSERT INTO {$table12} (longitude, latitude, altitude) VALUES ('{$GPSLongitude}', '{$GPSLatitude}', '{$GPSAltitude}')");
        echo mysql_error();
        $loc_id = mysql_insert_id();
        echo mysql_error();
        $result16 = mysql_query("UPDATE {$table2} SET loc_id = '{$loc_id}' WHERE pic_id = '{$pic_id}'");
        echo mysql_error();
    }
}
コード例 #3
0
 $DateTimeOriginal = mysql_result($result8, isset($i8), 'DateTimeOriginal');
 $FileName = mysql_result($result8, isset($i8), 'FileName');
 $FileNameOri = mysql_result($result8, isset($i8), 'FileNameOri');
 $user_id = mysql_result($result8, isset($i8), 'Owner');
 $result10 = mysql_query("SELECT username, titel, vorname, name, ort FROM {$table1} WHERE id = '{$user_id}'");
 @($Owner = mysql_result($result10, $i10, 'username'));
 @($titel = mysql_result($result10, $i10, 'titel'));
 @($vorname = mysql_result($result10, $i10, 'vorname'));
 @($name = mysql_result($result10, $i10, 'name'));
 @($ort = mysql_result($result10, $i10, 'ort'));
 $FileSize = mysql_result($result8, isset($i8), 'FileSize');
 $Width = mysql_result($result8, isset($i8), 'ExifImageWidth');
 $Height = mysql_result($result8, isset($i8), 'ExifImageHeight');
 $Description = mysql_result($result8, isset($i8), 'Caption_Abstract');
 $note = mysql_result($result8, isset($i8), 'note');
 $bild = $pic_path . "/" . restoreOriFilename($pic_id, $sr);
 $Orientation = trim(shell_exec($exiftool . " -s -S '-Orientation' " . $bild));
 //echo $Orientation;
 if (isset($Orientation) and $Orientation !== '') {
     $ausrichtung = $Orientation;
 } else {
     $ausrichtung = "nicht vermerkt";
 }
 //Welche Kategorien wurden dem Bild zugewiesen?
 $result9 = mysql_query("SELECT DISTINCT {$table10}.pic_id, {$table10}.kat_id, {$table4}.kat_id, {$table4}.kategorie, {$table4}.level FROM {$table10} INNER JOIN {$table4} ON ({$table10}.kat_id = {$table4}.kat_id AND {$table10}.pic_id = '{$pic_id}') ORDER BY {$table4}.level");
 $num9 = mysql_num_rows($result9);
 $kat_info = '';
 for ($i9 = 1; $i9 < $num9; $i9++) {
     //echo $num5."<BR>";
     $kategorie = htmlentities(mysql_result($result9, $i9, 'kategorie'));
     $kat_id = mysql_result($result9, $i9, $table4 . '.kat_id');
コード例 #4
0
    	@$diary_info = mysql_result($result5, isset($i5), 'info');
    	@$datum = date('d.m.Y', strtotime(mysql_result($result5, isset($i5), 'datum')));
    }
    */
    $result5 = mysql_query("SELECT DateTimeOriginal FROM {$table2} WHERE pic_id = '{$pic_id}'");
    $dat = date('Y-m-d', strtotime(mysql_result($result5, 0, 'DateTimeOriginal')));
    $res6 = mysql_query("SELECT * FROM {$table3} WHERE datum = '{$dat}'");
    //echo mysql_error();
    @($diary_info = mysql_result($res6, isset($i6), 'info'));
    @($datum = date('d.m.Y', strtotime(mysql_result($res6, isset($i6), 'datum'))));
    if ($diary_info != '') {
        echo "\n\t\t<TR style='background-color:lightgreen;'>\n\t\t\t<TD class='liste2' style='width:450px;' colspan='2' >Tagebucheintrag zum <u>{$datum}</u>:</TD>\n\t\t</TR>\n\t\t\n\t\t<TR style='background-color:white;'>\n\t\t\t<TD class='liste2' style='width:450px; border-left-style:solid; border-left-width:3px; border-color:red; padding-left:3px;' colspan='2' >" . $diary_info . "</TD>\n\t\t</TR>";
    }
}
echo "\n\t<TR style='background-color:lightgreen;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >---- Link zum HQ-Bild ----</TD>\n\t</TR>\n\t\n\t<TR style='background-color:white;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >http://" . $_SERVER['SERVER_NAME'] . "" . $inst_path . "/pic2base/images/vorschau/hq-preview/" . $FileNameHQ . "</TD>\n\t</TR>\n\t\n\t<TR style='background-color:lightgreen;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >---- monochrome Vorschau ----</TD>\n\t</TR>\n\t\n\t<TR style='background-color:white;'>\n\t\t<TD class='liste2' style='width:450px;text-align:center;' colspan='2' ><img src=\"../../images/monochrome/" . $pic_id . "_mono.jpg\" width='400px' alt='Monochrome-Ansicht' title='Monochrome-Ansicht' border='0' /></TD>\n\t</TR>";
if ($ed == '') {
    echo "\n\t\t<TR style='background-color:white; color:red;'>\n\t\t\t<TD class='liste2' style='width:450px;text-align:center; border-right-style:solid; border-right-width:3px; border-left-style:solid; border-left-width:3px; border-color:red;' colspan='2'>\n\t\t\t<b>Das Dateiformat des Originalbildes kann keine Meta-Daten speichern.</B>\n\t\t\t</TD>\n\t\t</TR>";
}
echo "\n\t<!--\n\t<TR style='background-color:white;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >Link zum <a href=http://" . $_SERVER['SERVER_NAME'] . $inst_path . "/pic2base/images/originale/" . restoreOriFilename($pic_id, $sr) . ">Originalbild</a></TD>\n\t</TR>\n\t-->\n\t\n\t<TR class='normal' style='height:3px;'>\n\t\t<TD class='normal' bgcolor='#FF9900' colspan = '2'>\n\t\t</TD>\n\t</TR>";
//echo count($writable_fields);
//IF(($editable == '1' OR count(isset($writable_fields)) > 0) AND $u_name === $c_username AND $ed !== '')
if (($editable == '1' or count(isset($writable_fields)) > 0) and ($Owner == $uid and hasPermission($uid, 'editmypics', $sr) or $Owner !== $uid and hasPermission($uid, 'editallpics', $sr)) and $ed !== '') {
    echo "\n\t\t<TR class='normal'>\n\t\t\t<TD class='normal'>Meta-Daten editieren&#160;&#160;\n\t\t\t<A HREF='edit_details.php?pic_id={$pic_id}'><img src=\"images/edit.gif\" width=\"15\" height=\"15\" border='none' title='Meta-Daten editieren' style='vertical-align:sub;' /></A>\n\t\t\t</TD>\n\t\t\t<TD class='normal'>Fenster schliessen&#160;&#160;\n\t\t\t<A HREF='javascript:window.close()'><img src=\"images/close.gif\" width=\"15\" height=\"15\" border='none' title='Fenster schliessen' style='vertical-align:sub;' /></A>\n\t\t\t</TD>\n\t\t</TR>";
} else {
    echo "\n\t\t<TR class='normal'>\n\t\t\t<TD class='normal' colspan = '2' align='right'>Fenster schliessen&#160;&#160;\n\t\t\t<A HREF='javascript:window.close()'><img src=\"images/close.gif\" width=\"15\" height=\"15\" border='none' title='Fenster schliessen' style='vertical-align:sub; margin-right:10px;' /></A>\n\t\t\t</TD>\n\t\t</TR>";
}
echo "\n\t<TR class='normal' style='height:3px;'>\n\t\t<TD class='normal' bgcolor='#FF9900' colspan = '2'>\n\t\t</TD>\n\t</TR>\n</TABLE>";
//print_r($writable_fields);
?>
</body>
</html>
コード例 #5
0
        $res3 = mysql_query("UPDATE {$table14} SET Caption_Abstract = '{$Description}' WHERE pic_id = '{$bild_id}'");
        $FN = $pic_path . "/" . restoreOriFilename($bild_id, $sr);
        $desc = htmlentities($Description);
        //echo $FN.", ".$desc."<BR>";
        shell_exec($et_path . "/exiftool -IPTC:Caption-Abstract='{$desc}' " . $FN . " -overwrite_original");
    }
    if (mysql_errno() == '0') {
        echo "<p style='color:green; font-size:12px; font-family:Helvitica,Arial;'>Daten&uuml;bernahme...</p>\n\t\t\t<meta http-equiv='refresh' content='2; url=edit_beschreibung.php?kat_id={$kat_back}&ID={$ID_back}'>";
    } else {
        echo "Es ist ein Fehler aufgetreten!";
    }
} else {
    if ($art == 'single_desc_edit') {
        $description = strip_tags($description);
        $res3 = mysql_query("UPDATE {$table14} SET Caption_Abstract = '{$description}' WHERE pic_id = '{$PIC_id}'");
        $FN = $pic_path . "/" . restoreOriFilename($PIC_id, $sr);
        $desc = htmlentities($Description);
        //echo $FN.", ".$desc."<BR>";
        shell_exec($et_path . "/exiftool -IPTC:Caption-Abstract='{$desc}' " . $FN . " -overwrite_original");
        echo "<p style='color:green; font-size:12px; font-family:Helvitica,Arial;'>Daten&uuml;bernahme...</p>\n\t\t\t<meta http-equiv='refresh' content='2; url=edit_beschreibung.php?kat_id={$kat_back}&ID={$ID_back}'>";
    } else {
        echo "<p class='zwoelfred' align='center'>Sie haben kein Bild zur Bearbeitung ausgew&auml;hlt!<BR><BR>\n\t\t\tBitte w&auml;hlen Sie mindestens ein Bild aus<BR>oder verlassen Sie den vorhergehenden Dialog<BR>mit \"Abbrechen\"!</p>\n\t\t\t<meta http-equiv='refresh' content='3; url=edit_beschreibung.php?kat_id={$kat_back}&ID={$ID_back}'>";
    }
}
echo "\n\t</div>\n\t<br style='clear:both;' />\n\t<p id='fuss'><A style='margin-right:745px;' HREF='http://www.pic2base.de' target='blank'>www.pic2base.de</A>" . $cr . "</p>\n</div>";
mysql_close($conn);
?>
</DIV>
</CENTER>
</BODY>
</HTML>
コード例 #6
0
function extractExifData($pic_id, $sr)
{
    include $sr . '/bin/share/global_config.php';
    include $sr . '/bin/share/db_connect1.php';
    $result6 = mysql_query("SELECT * FROM {$table14} WHERE pic_id = '{$pic_id}'");
    if (mysql_num_rows($result6) == 0) {
        //nur wenn es noch keinen Eintrag in der exif-data-Tabelle f�r dieses Bild gibt, wird die Erfassung ausgef�hrt:
        $result7 = mysql_query("INSERT INTO {$table14} (pic_id) VALUES ('{$pic_id}')");
        //Ermittlung des Original-Dateinamens mit eindeutiger Bezeichnung (z.B. 12345.nef):
        $FN = $pic_path . "/" . restoreOriFilename($pic_id, $sr);
        //echo "Original-Datei-Name: ".$FN."<BR>";
        $result8 = mysql_query("SHOW COLUMNS FROM {$table14}");
        $i = 0;
        if ($result8 != false) {
            while ($liste = mysql_fetch_row($result8)) {
                //$tab_fieldname[$i] = $liste[0];	//vorh. Tabellen-Feldname
                $tab_fieldname[$i] = str_replace('_', '-', $liste[0]);
                //vorh. Tabellen-Feldname
                $i++;
            }
        } else {
            die('Fehler bei der Datenbankabfrage');
        }
        //F�r jedes Feld der Meta-Daten-Tabelle wird ein evtl. vorhandener Datenwert augelesen und in die Tabelle geschrieben:
        $text = shell_exec($et_path . "/exiftool " . $FN);
        $inf_arr = explode(chr(10), $text);
        //Zerlegung des Textes am Zeilenumbruch
        //echo count($inf_arr)." Meta-Angaben im Bild ".$FN."<BR><BR>";;
        foreach ($inf_arr as $IA) {
            $F_W = explode(' : ', $IA);
            //Zerlegung der Zeilen in Feld und Wert
            $fieldname = $F_W[0];
            //'Bereinigung des Feldnamen:
            $fieldname = str_replace(" ", "", $fieldname);
            $fieldname = str_replace("/", "", $fieldname);
            $fieldname = str_replace("-", "_", $fieldname);
            if (count($F_W) > 1) {
                $value = trim($F_W[1]);
            } else {
                $value = '';
            }
            if (in_array($fieldname, $tab_fieldname)) {
                //$value = formatValues($fieldname,$bild,$et_path);
                if ($fieldname == 'DateTimeOriginal') {
                    $tmp_value = explode(" ", $value);
                    $value = str_replace(':', '-', $tmp_value[0]) . " " . $tmp_value[1];
                }
                if ($fieldname == 'FileSize') {
                    $value = shell_exec($et_path . "/exiftool -FileSize -n " . $FN);
                    $fs_arr = explode(' : ', $value);
                    $value = trim($fs_arr[1]);
                }
                //echo ">>> Feld ".$fieldname." hat den Wert ".$value."<BR>";
                //Bildbreite- und H�he werden zur Sicherheit in 2 Felder (ExifImageHeight (Width) UND ImageHeight (WIdth)) geschrieben:
                if (($fieldname == 'ExifImageHeight' or $fieldname == 'ImageHeight') and ($value !== '0' and $value !== '')) {
                    $result4 = mysql_query("UPDATE {$table14} SET ExifImageHeight = '{$value}', ImageHeight = '{$value}' WHERE pic_id = '{$pic_id}'");
                } elseif (($fieldname == 'ExifImageWidth' or $fieldname == 'ImageWidth') and ($value !== '0' and $value !== '')) {
                    $result4 = mysql_query("UPDATE {$table14} SET ExifImageWidth = '{$value}', ImageWidth = '{$value}' WHERE pic_id = '{$pic_id}'");
                } elseif (($fieldname == 'ExifImageHeight' or $fieldname == 'ImageHeight' or $fieldname == 'ExifImageWidth' or $fieldname == 'ImageWidth') and ($value == '0' or $value == '')) {
                    //keine Aktualisierung!
                } else {
                    $result4 = mysql_query("UPDATE {$table14} SET {$fieldname} = '{$value}' WHERE pic_id = '{$pic_id}'");
                }
                if (mysql_error() !== '') {
                    echo "Fehler beim speichern der Meta-Daten: " . mysql_error() . "<BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>";
                }
            }
        }
        //Wenn Breite, H�he, Dateigr��e oder Ausrichtung nicht ermittelt werden konnte, wird versucht, dies per PHP-Routinen zu erledigen:
        $result9 = mysql_query("SELECT * FROM {$table14} WHERE pic_id = '{$pic_id}'");
        $row = mysql_fetch_array($result9);
        $ImageWidth = $row['ImageWidth'];
        $ImageHeight = $row['ImageHeight'];
        $FileSize = $row['FileSize'];
        $Orientation = $row['Orientation'];
        // $ImageWidth = mysql_result($result9, $i9, 'ImageWidth');
        // $ImageHeight = mysql_result($result9, $i9, 'ImageHeight');
        // $FileSize = mysql_result($result9, $i9, 'FileSize');
        // $Orientation = mysql_result($result9, $i9, 'Orientation');
        @($params = getimagesize($FN));
        $breite = $params[0];
        $hoehe = $params[1];
        clearstatcache();
        $FileSize = filesize($FN);
        //Dateigr��e in Byte
        if ($ImageWidth == '0' or $ImageWidth == '') {
            $result10 = mysql_query("UPDATE {$table14} SET ImageWidth = '{$breite}' WHERE pic_id = '{$pic_id}'");
        }
        if ($ImageHeight == '0' or $ImageHeight == '') {
            $result11 = mysql_query("UPDATE {$table14} SET ImageHeight = '{$hoehe}' WHERE pic_id = '{$pic_id}'");
        }
        if ($FileSize == '0' or $FileSize == '') {
            $result12 = mysql_query("UPDATE {$table14} SET FileSize = '{$FileSize}' WHERE pic_id = '{$pic_id}'");
        }
        //Ausrichtung wird intern immer als '1' angesehen!
        $result13 = mysql_query("UPDATE {$table14} SET Orientation = '1' WHERE pic_id = '{$pic_id}'");
    }
}
コード例 #7
0
function createPreviewAjax($pic_id, $max_size, $quality)
{
    unset($username);
    if ($_COOKIE['login']) {
        list($c_username) = preg_split('#,#', $_COOKIE['login']);
    }
    //Erzeugung einer Bildvorschau unter optimaler Nutzung des Bildschirmes;
    //Qualitaeten: 1 - Vorschaubild; 2 - HQ-Bild; 3 - Original-Bild
    include '../share/global_config.php';
    include $sr . '/bin/share/db_connect1.php';
    $exiftool = buildExiftoolCommand($sr);
    $res0 = mysql_query("SELECT * FROM {$table2} WHERE pic_id='{$pic_id}'");
    $row = mysql_fetch_array($res0);
    $FileNameV = $row['FileNameV'];
    $FileNameHQ = $row['FileNameHQ'];
    $FileName = $row['FileName'];
    $FileNameOri = $row['FileNameOri'];
    $FileNameOri_ext = explode('.', $FileNameOri);
    $ext = strtolower(isset($FileNameOri_ext[1]));
    //Extension des Original-Bildes
    $result1 = mysql_query("SELECT * FROM {$table14} WHERE pic_id = '{$pic_id}'");
    $Width = mysql_result($result1, isset($i1), 'ExifImageWidth');
    $Height = mysql_result($result1, isset($i1), 'ExifImageHeight');
    $bild = $pic_path . "/" . restoreOriFilename($pic_id, $sr);
    $Ori_arr = preg_split('# : #', shell_exec($exiftool . " -Orientation -n " . $bild));
    //numerischer Wert der Ausrichtung des Originalbildes
    //	echo $bild."<br>";
    if ($Ori_arr[0] != '') {
        $Orientation = $Ori_arr[1];
    } else {
        $Orientation = '';
    }
    //echo $Orientation;
    $FileQuality = mysql_result($result1, isset($i1), 'Quality');
    //abgeleitete Groessen:
    $parameter_v = getimagesize($sr . '/images/vorschau/thumbs/' . $FileNameV);
    $parameter_hq = getimagesize($sr . '/images/vorschau/hq-preview/' . $FileNameHQ);
    $parameter_o = getimagesize($sr . '/images/originale/' . $FileName);
    switch ($quality) {
        case '1':
            $breite = $parameter_v[0];
            $hoehe = $parameter_v[1];
            $bildname = 'http://' . $sr . '/images/vorschau/thumbs/' . $FileNameV;
            break;
        case '2':
            $breite = $parameter_hq[0];
            $hoehe = $parameter_hq[1];
            $bildname = 'http://' . $sr . '/images/vorschau/hq-preview/' . $FileNameHQ;
            break;
        case '3':
            $breite = $parameter_o[0];
            $hoehe = $parameter_o[1];
            switch ($Orientation) {
                case '':
                case 0:
                case 1:
                    $bildname = 'http://' . $_SERVER['SERVER_NAME'] . $inst_path . '/pic2base/images/originale/' . $FileName;
                    break;
                default:
                    //wenn das bild nicht landscape ist wird gepr�ft, ob es dieses Bild schon in gedrehter Form gibt:
                    $verz = opendir($sr . '/images/originale/rotated');
                    $n = 0;
                    while ($bilddatei = readdir($verz)) {
                        if ($bilddatei != "." && $bilddatei != "..") {
                            //$bildd=$bilder_verzeichnis."/".$bilddatei;
                            //echo "Bild: ".$bilddatei."; Datei: ".$file_name."<BR>";
                            if ($bilddatei == $FileName) {
                                $n++;
                            }
                        }
                    }
                    //			echo "N: ".$n."<BR>";
                    if ($n > '0') {
                        //wenn ein bereits gedrehtes Bild gefunden wurde, verwende dies:
                        $bildname = 'http://' . $_SERVER['SERVER_NAME'] . $inst_path . '/pic2base/images/originale/rotated/' . $FileName;
                    } else {
                        //wenn keins gefunden wurde wird es gedreht und dann angezeigt:
                        $bildname = 'http://' . $_SERVER['SERVER_NAME'] . $inst_path . '/pic2base/images/originale/' . $FileName;
                        if ($ext == 'nef') {
                            copy("{$pic_path}/{$FileName}", "{$pic_rot_path}/{$FileName}");
                            clearstatcache();
                            chmod($pic_rot_path . "/" . $FileName, 0700);
                            clearstatcache();
                        } else {
                            switch ($Orientation) {
                                case 3:
                                    //Das Vorschaubild muss 180 gedreht werden:
                                    $command = "/usr/bin/convert " . $pic_path . "/" . $FileName . " -rotate 180 " . $pic_rot_path . "/" . $FileName . "";
                                    $output = shell_exec($command);
                                    break;
                                case 6:
                                    //Das Vorschaubild muss 90 im Uhrzeigersinn gedreht werden:
                                    $command = "/usr/bin/convert " . $pic_path . "/" . $FileName . " -rotate 90 " . $pic_rot_path . "/" . $FileName . "";
                                    //echo $command;
                                    $output = shell_exec($command);
                                    break;
                                case 8:
                                    //Das Vorschaubild muss 90 entgegen dem Uhrzeigersinn gedreht werden:
                                    $command = "/usr/bin/convert " . $pic_path . "/" . $FileName . " -rotate 270 " . $pic_rot_path . "/" . $FileName . "";
                                    $output = shell_exec($command);
                                    break;
                            }
                        }
                    }
                    $parameter_o_r = getimagesize($sr . '/images/originale/rotated/' . $FileName);
                    $breite = $parameter_o_r[0];
                    $hoehe = $parameter_o_r[1];
                    break;
            }
            //echo $bildname;
            break;
    }
    $ratio_pic = $breite / $hoehe;
    //echo $breite." - ".$hoehe;
    //echo $FileQuality;
    switch ($Orientation) {
        case '':
        case '0':
        case '1':
        case '3':
            $Height = mysql_result($result1, isset($i1), 'ExifImageHeight');
            $Width = mysql_result($result1, isset($i1), 'ExifImageWidth');
            break;
        case '6':
        case '8':
            $Height = mysql_result($result1, $i1, 'ExifImageWidth');
            $Width = mysql_result($result1, $i1, 'ExifImageHeight');
            break;
    }
    $breite_v = $parameter_v[0];
    $hoehe_v = $parameter_v[1];
    if ($breite_v >= $hoehe_v) {
        $Breite = $max_size;
        $Hoehe = number_format($Breite * $hoehe_v / $breite_v, 0, ',', '.');
    } else {
        $Hoehe = $max_size;
        $Breite = number_format($Hoehe * $breite_v / $hoehe_v, 0, ',', '.');
    }
    //echo "O: ".$Orientation.", B: ".$breite_v.", H: ".$hoehe_v."<BR>";
    echo "<a href='' onclick=\"ZeigeBild('{$bildname}', '{$Width}', '{$Height}', '{$ratio_pic}', 'ori');return false\"  title='Ansicht in optimaler Qualit&auml;t'>\n\t<img src='{$inst_path}/pic2base/images/vorschau/thumbs/{$FileNameV}' alt='Vorschaubild' width={$Breite} height={$Hoehe} z='5'>\n\t</a>\n\t<img src='{$bildname}' width=1 height=1 border=0 z='-99'>";
}
コード例 #8
0
            } else {
                $color = 'black';
            }
        }
        switch ($view) {
            case 'kompact':
                if (in_array($tag, $viewable_fields)) {
                    echo "<TR class='normal' style='height:3px;' bgcolor = '{$bgcolor}';>";
                    echo "<TD class='liste2' style='width:225px;'><FONT COLOR='{$color}'>" . $tag . "</FONT></TD>\n\t\t\t\t<TD class='liste2' style='width:225px;'>" . $value . "</TD>\n\t\t\t\t</TR>";
                }
                break;
            case 'all':
                echo "<TR class='normal' style='height:3px;' bgcolor = '{$bgcolor}';>";
                echo "<TD class='liste2' style='width:225px;'><FONT COLOR='{$color}'>" . $tag . "</FONT></TD>\n\t\t\t<TD class='liste2' style='width:225px;'>" . $value . "</TD>\n\t\t\t</TR>";
                break;
        }
    }
    $n++;
}
echo "\n\t<TR style='background-color:lightgreen;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >---- Link zum HQ-Bild ----</TD>\n\t</TR>\n\t\n\t<TR style='background-color:white;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >http://" . $_SERVER['SERVER_NAME'] . "" . $inst_path . "/pic2base/images/vorschau/hq-preview/" . $FileNameHQ . "</TD>\n\t</TR>\n\t\n\t<TR style='background-color:lightgreen;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >---- monochrome Vorschau ----</TD>\n\t</TR>\n\t\n\t<TR style='background-color:white;'>\n\t\t<TD class='liste2' style='width:450px;text-align:center;' colspan='2' ><img src=\"../../images/monochrome/" . $pic_id . "_mono.jpg\" width='400px' alt='Monochrome-Ansicht' title='Monochrome-Ansicht' border='0' /></TD>\n\t</TR>\n\t\n\t<!--\n\t<TR style='background-color:white;'>\n\t\t<TD class='liste2' style='width:450px;' colspan='2' >Link zum <a href=http://" . $_SERVER['SERVER_NAME'] . $inst_path . "/pic2base/images/originale/" . restoreOriFilename($pic_id, $sr) . ">Originalbild</a></TD>\n\t</TR>\n\t-->\n\t\n\t<TR class='normal' style='height:3px;'>\n\t\t<TD class='normal' bgcolor='#FF9900' colspan = '2'>\n\t\t</TD>\n\t</TR>";
//echo count($writable_fields);
if (($editable == '1' or count(isset($writable_fields)) > 0) and $u_name === $c_username) {
    echo "\n\t\t<TR class='normal'>\n\t\t\t<TD class='normal'>Meta-Daten editieren&#160;&#160;\n\t\t\t<A HREF='edit_details.php?pic_id={$pic_id}'><img src=\"images/edit.gif\" width=\"15\" height=\"15\" border='none' title='Meta-Daten editieren' style='vertical-align:sub;' /></A>\n\t\t\t</TD>\n\t\t\t<TD class='normal'>Fenster schliessen&#160;&#160;\n\t\t\t<A HREF='javascript:window.close()'><img src=\"images/close.gif\" width=\"15\" height=\"15\" border='none' title='Fenster schliessen' style='vertical-align:sub;' /></A>\n\t\t\t</TD>\n\t\t</TR>";
} else {
    echo "\n\t\t<TR class='normal'>\n\t\t\t<TD class='normal' colspan = '2' align='right'>Fenster schliessen&#160;&#160;\n\t\t\t<A HREF='javascript:window.close()'><img src=\"images/close.gif\" width=\"15\" height=\"15\" border='none' title='Fenster schliessen' style='vertical-align:sub; margin-right:10px;' /></A>\n\t\t\t</TD>\n\t\t</TR>";
}
echo "\n\t<TR class='normal' style='height:3px;'>\n\t\t<TD class='normal' bgcolor='#FF9900' colspan = '2'>\n\t\t</TD>\n\t</TR>\n</TABLE>";
//print_r($writable_fields);
?>
</body>
</html>