コード例 #1
0
 *
 * Copyright (c) 2003 - 2013 Klaus Henneberg
 *
 * Project owner:
 * Dipl.-Ing. Klaus Henneberg
 * 38889 Blankenburg, BRD
 *
 * This file is licensed under the terms of the Open Software License
 * http://www.opensource.org/licenses/osl-2.1.php
 */
include '../../share/global_config.php';
include $sr . '/bin/share/db_connect1.php';
include $sr . '/bin/share/functions/main_functions.php';
$result0 = mysql_query("SELECT * FROM {$table1} WHERE id = '{$uid}' AND aktiv = '1'");
$username = mysql_result($result0, isset($i0), 'username');
$conv = buildConvertCommand($sr);
$identify = str_replace('convert', 'identify', $conv);
$sup_ft_arr = explode(chr(10), shell_exec($identify . " -list format"));
//unterstuetzte Dateiformate
$page = $_GET['page'];
foreach ($sup_ft_arr as $SFT) {
    $SFT = str_replace("  ", "", $SFT);
    $zeil_arr = explode(chr(32), $SFT);
    if (isset($zeil_arr[2])) {
        $mod = $zeil_arr[2];
    } else {
        $mod = ' ';
    }
    if ($mod !== ' ') {
        $file_format = strtolower(str_replace('*', '', $zeil_arr[0]));
    }
コード例 #2
0
function generateHistogram($pic_id, $FileName, $sr)
{
    include $sr . '/bin/share/global_config.php';
    include $sr . '/bin/share/db_connect1.php';
    //Wenn mind. ein Bild nicht vorhanden ist, werden die Histogramme neu erstellt:
    $file_mono = $monochrome_path . "/" . $pic_id . "_mono.jpg";
    $hist = $hist_path . "/" . $pic_id . "_hist.gif";
    $hist_r = $hist_path . "/" . $pic_id . "_hist_0.gif";
    $hist_g = $hist_path . "/" . $pic_id . "_hist_1.gif";
    $hist_b = $hist_path . "/" . $pic_id . "_hist_2.gif";
    $conv = buildConvertCommand($sr);
    if (@(!fopen($hist, 'r')) or @(!fopen($hist_r, 'r')) or @(!fopen($hist_g, 'r')) or @(!fopen($hist_b, 'r')) or @(!fopen($file_mono, 'r'))) {
        //$file = $pic_path."/".$FileName; <- wird verwendet, wenn Histogr. aus Originalbild erstellt wird
        $file = $pic_hq_path . "/" . $FileName;
        //<- aus Performance-Gruenden wird Histogr. aus HQ-Bild erstellt!
        shell_exec($conv . " " . $file . " -separate histogram:" . $hist_path . "/" . $pic_id . "_hist_%d.gif");
        shell_exec($conv . " " . $file . " -colorspace Gray -quality 80% " . $monochrome_path . "/" . $pic_id . "_mono.jpg");
        $file_mono = $monochrome_path . "/" . $pic_id . "_mono.jpg";
        shell_exec($conv . " " . $file_mono . " histogram:" . $hist_path . "/" . $pic_id . "_hist.gif");
        $hist_file_r = $pic_id . '_hist_0.gif';
        shell_exec($conv . " " . $hist_path . "/" . $hist_file_r . " -fill red -opaque white " . $hist_path . "/" . $hist_file_r);
        $hist_file_g = $pic_id . '_hist_1.gif';
        shell_exec($conv . " " . $hist_path . "/" . $hist_file_g . " -fill green -opaque white " . $hist_path . "/" . $hist_file_g);
        $hist_file_b = $pic_id . '_hist_2.gif';
        shell_exec($conv . " " . $hist_path . "/" . $hist_file_b . " -fill blue -opaque white " . $hist_path . "/" . $hist_file_b);
        $hist_file = $pic_id . '_hist.gif';
        $mono_file = $pic_id . "_mono.jpg";
        $result2 = mysql_query("UPDATE {$table2} SET FileNameMono = '{$mono_file}', FileNameHist = '{$hist_file}', FileNameHist_r = '{$hist_file_r}', FileNameHist_g = '{$hist_file_g}', FileNameHist_b = '{$hist_file_b}' WHERE pic_id = '{$pic_id}'");
        echo mysql_error();
        clearstatcache();
        chmod($file_mono, 0700);
        chmod($hist, 0700);
        chmod($hist_r, 0700);
        chmod($hist_g, 0700);
        chmod($hist_b, 0700);
        clearstatcache();
    }
}
コード例 #3
0
        $output = shell_exec($command . " > /dev/null &");
        $command = buildConvertCommand($sr) . " " . $monochrome_path . "/" . $fn_mono . " -rotate 180 " . $monochrome_path . "/" . $fn_mono . "";
        $output = shell_exec($command . " > /dev/null &");
        break;
    case '6':
        //die Bilder muessen 90 im Uhrzeigersinn gedreht werden:
        $command = buildConvertCommand($sr) . " " . $pic_path . "/" . $fn_o . " -rotate 90 " . $pic_path . "/" . $fn_o . "";
        $output = shell_exec($command . " > /dev/null &");
        $command = buildConvertCommand($sr) . " " . $pic_thumbs_path . "/" . $fn_v . " -rotate 90 " . $pic_thumbs_path . "/" . $fn_v . "";
        $output = shell_exec($command . " > /dev/null &");
        $command = buildConvertCommand($sr) . " " . $pic_hq_path . "/" . $fn_hq . " -rotate 90 " . $pic_hq_path . "/" . $fn_hq . "";
        $output = shell_exec($command . " > /dev/null &");
        $command = buildConvertCommand($sr) . " " . $monochrome_path . "/" . $fn_mono . " -rotate 90 " . $monochrome_path . "/" . $fn_mono . "";
        $output = shell_exec($command . " > /dev/null &");
        break;
    case '8':
        //die Bilder muessen 90 entgegen dem Uhrzeigersinn gedreht werden:
        $command = buildConvertCommand($sr) . " " . $pic_path . "/" . $fn_o . " -rotate 270 " . $pic_path . "/" . $fn_o . "";
        $output = shell_exec($command . " > /dev/null &");
        $command = buildConvertCommand($sr) . " " . $pic_thumbs_path . "/" . $fn_v . " -rotate 270 " . $pic_thumbs_path . "/" . $fn_v . "";
        $output = shell_exec($command . " > /dev/null &");
        $command = buildConvertCommand($sr) . " " . $pic_hq_path . "/" . $fn_hq . " -rotate 270 " . $pic_hq_path . "/" . $fn_hq . "";
        $output = shell_exec($command . " > /dev/null &");
        $command = buildConvertCommand($sr) . " " . $monochrome_path . "/" . $fn_mono . " -rotate 270 " . $monochrome_path . "/" . $fn_mono . "";
        $output = shell_exec($command . " > /dev/null &");
        break;
}
//dann wird lt. Festlegung die Ausrichtung auf 1 gesetzt
$result1 = mysql_query("UPDATE {$table2} SET Orientation = '1' WHERE pic_id = '{$pic_id}'");
$time = time();
echo "Bitte Ansicht<BR> neu laden";
コード例 #4
0
function generateHistogram($pic_id, $FileName, $sr)
{
    include $sr . '/bin/share/global_config.php';
    include $sr . '/bin/share/db_connect1.php';
    //Wenn mind. ein Bild nicht vorhanden ist, werden die Histogramme neu erstellt:
    $file_mono = $monochrome_path . "/" . $pic_id . "_mono.jpg";
    $hist = $hist_path . "/" . $pic_id . "_hist.gif";
    $hist_r = $hist_path . "/" . $pic_id . "_hist_0.gif";
    $hist_g = $hist_path . "/" . $pic_id . "_hist_1.gif";
    $hist_b = $hist_path . "/" . $pic_id . "_hist_2.gif";
    $conv = buildConvertCommand($sr);
    $mf = 0;
    //$mf - missing files: Anzahl der fehlenden Dateien fuer Histogramme u. Monochrome Bilder
    //wieviel von den hist- und monochrome-Files fehlen tatsaechlich bei dem Bild mit der genannten pic_id?
    $mf = file_exists($hist) ? $mf : $mf + 1;
    $mf = file_exists($hist_r) ? $mf : $mf + 1;
    $mf = file_exists($hist_g) ? $mf : $mf + 1;
    $mf = file_exists($hist_b) ? $mf : $mf + 1;
    $mf = file_exists($file_mono) ? $mf : $mf + 1;
    $file = $pic_hq_path . "/" . $FileName;
    //<- aus Performance-Gruenden wird Histogr. aus HQ-Bild erstellt!
    shell_exec($conv . " " . $file . " -separate histogram:" . $hist_path . "/" . $pic_id . "_hist_%d.gif");
    if (!file_exists($hist)) {
        shell_exec($conv . " " . $file . " -colorspace Gray -quality 80% " . $monochrome_path . "/" . $pic_id . "_mono.jpg");
        $file_mono = $monochrome_path . "/" . $pic_id . "_mono.jpg";
        $hist_file = $pic_id . '_hist.gif';
        shell_exec($conv . " " . $file_mono . " histogram:" . $hist_path . "/" . $hist_file);
        $result1 = mysql_query("UPDATE {$table2} SET FileNameHist = '{$hist_file}' WHERE pic_id = '{$pic_id}'");
        echo mysql_error();
        clearstatcache();
        chmod($hist, 0700);
        clearstatcache();
        //$mf++;
    }
    if (!file_exists($hist_r)) {
        $hist_file_r = $pic_id . '_hist_0.gif';
        shell_exec($conv . " " . $hist_path . "/" . $hist_file_r . " -fill red -opaque white " . $hist_path . "/" . $hist_file_r);
        $result2 = mysql_query("UPDATE {$table2} SET FileNameHist_r = '{$hist_file_r}' WHERE pic_id = '{$pic_id}'");
        echo mysql_error();
        clearstatcache();
        chmod($hist_r, 0700);
        clearstatcache();
        //$mf++;
    }
    if (!file_exists($hist_g)) {
        $hist_file_g = $pic_id . '_hist_1.gif';
        shell_exec($conv . " " . $hist_path . "/" . $hist_file_g . " -fill green -opaque white " . $hist_path . "/" . $hist_file_g);
        $result3 = mysql_query("UPDATE {$table2} SET FileNameHist_g = '{$hist_file_g}' WHERE pic_id = '{$pic_id}'");
        echo mysql_error();
        clearstatcache();
        chmod($hist_g, 0700);
        clearstatcache();
        //$mf++;
    }
    if (!file_exists($hist_b)) {
        $hist_file_b = $pic_id . '_hist_2.gif';
        shell_exec($conv . " " . $hist_path . "/" . $hist_file_b . " -fill blue -opaque white " . $hist_path . "/" . $hist_file_b);
        $result4 = mysql_query("UPDATE {$table2} SET FileNameHist_b = '{$hist_file_b}' WHERE pic_id = '{$pic_id}'");
        echo mysql_error();
        clearstatcache();
        chmod($hist_b, 0700);
        clearstatcache();
        //$mf++;
    }
    if (!file_exists($file_mono)) {
        shell_exec($conv . " " . $file . " -colorspace Gray -quality 80% " . $monochrome_path . "/" . $pic_id . "_mono.jpg");
        $mono_file = $pic_id . "_mono.jpg";
        $result5 = mysql_query("UPDATE {$table2} SET FileNameMono = '{$mono_file}' WHERE pic_id = '{$pic_id}'");
        echo mysql_error();
        clearstatcache();
        chmod($file_mono, 0700);
        clearstatcache();
        //$mf++;
    }
    //zur Sicherheit werden die Eintraege in der Tabelle pictures fuer die hist- und mono-files nochmals geschrieben:
    if (file_exists($file_mono) and file_exists($hist) and file_exists($hist_r) and file_exists($hist_g) and file_exists($hist_b)) {
        $mono_file = $pic_id . "_mono.jpg";
        $hist_file_b = $pic_id . '_hist_2.gif';
        $hist_file_g = $pic_id . '_hist_1.gif';
        $hist_file_r = $pic_id . '_hist_0.gif';
        $hist_file = $pic_id . '_hist.gif';
        $result6 = mysql_query("UPDATE {$table2} SET FileNameMono = '{$mono_file}', FileNameHist_b = '{$hist_file_b}', FileNameHist_g = '{$hist_file_g}', FileNameHist_r = '{$hist_file_r}', FileNameHist = '{$hist_file}' WHERE pic_id = '{$pic_id}'");
    }
    return $mf;
}
コード例 #5
0
        $command = buildConvertCommand($sr) . " " . $pic_hq_path . "/" . $fn_hq . " -rotate 180 " . $pic_hq_path . "/" . $fn_hq . "";
        $output = shell_exec($command);
        break;
    case '6':
        //die Bilder muessen 90 im Uhrzeigersinn gedreht werden:
        $command = buildConvertCommand($sr) . " " . $pic_path . "/" . $fn_o . " -rotate 90 " . $pic_path . "/" . $fn_o . "";
        $output = shell_exec($command);
        $command = buildConvertCommand($sr) . " " . $pic_thumbs_path . "/" . $fn_v . " -rotate 90 " . $pic_thumbs_path . "/" . $fn_v . "";
        $output = shell_exec($command);
        $command = buildConvertCommand($sr) . " " . $pic_hq_path . "/" . $fn_hq . " -rotate 90 " . $pic_hq_path . "/" . $fn_hq . "";
        $output = shell_exec($command);
        break;
    case '8':
        //die Bilder muessen 90 entgegen dem Uhrzeigersinn gedreht werden:
        $command = buildConvertCommand($sr) . " " . $pic_path . "/" . $fn_o . " -rotate 270 " . $pic_path . "/" . $fn_o . "";
        $output = shell_exec($command);
        $command = buildConvertCommand($sr) . " " . $pic_thumbs_path . "/" . $fn_v . " -rotate 270 " . $pic_thumbs_path . "/" . $fn_v . "";
        $output = shell_exec($command);
        $command = buildConvertCommand($sr) . " " . $pic_hq_path . "/" . $fn_hq . " -rotate 270 " . $pic_hq_path . "/" . $fn_hq . "";
        $output = shell_exec($command);
        break;
}
//dann wird lt. Festlegung die Ausrichtung auf 1 gesetzt
$result1 = mysql_query("UPDATE {$table14} SET Orientation = '1' WHERE pic_id = '{$pic_id}'");
$time = time();
echo "Bitte Ansicht<BR> neu laden";
/*
<SPAN style='cursor:pointer;' onClick='rotPrevPic(\"8\", \"$FileNameV\", \"$pic_id\", \"$fs_hoehe\")'><img src=\"$inst_path/pic2base/bin/share/images/90-ccw.gif\" width=\"10\" height=\"10\" style='margin-right:10px;' title='Vorschaubild 90&#176; links drehen' /></span>

<SPAN style='cursor:pointer;' onClick='rotPrevPic(\"6\", \"$FileNameV\", \"$pic_id\", \"$fs_hoehe\")'><img src=\"$inst_path/pic2base/bin/share/images/90-cw.gif\" width=\"10\" height=\"10\" style='margin-left:10px;' title='Vorschaubild 90&#176; rechts drehen' /></span>";
*/
コード例 #6
0
function checkSoftware($sr)
{
    include $sr . '/bin/share/db_connect1.php';
    //Kontrolle, ob erforderliche Software-Komponenten installiert sind:
    $et = shell_exec("which exiftool");
    $conv = shell_exec("which convert");
    $dc = shell_exec("which dcraw");
    $gb = shell_exec("which gpsbabel");
    $md = shell_exec("which md5sum");
    echo "\t<TABLE class='tablenormal' border='0'>\n\t\t<TR>\n\t\t<TD colspan='2'>Ergebnis der Software-Kontrolle:</TD>\n\t\t</TR>\n\t\t\n\t\t<TR class='trflach'>\n\t\t<TD colspan='2'></TD>\n\t\t</TR>";
    flush();
    sleep(1);
    if ($et == NULL) {
        echo "<TR>\n\t\t<TD class='tdleft'>ExifTool</TD>\n\t\t<TD class='tdright'><a href='http://www.sno.phy.queensu.ca/~phil/exiftool/index.html'>wurde nicht gefunden</a></TD>\n\t\t</TR>";
    } else {
        $v_et = shell_exec("exiftool -ver");
        echo "<TR>\n\t\t<TD class='tdleft'>ExifTool</TD>\n\t\t<TD class='tdright'><FONT COLOR='green'>ist in " . $et . " installiert (Ver. " . $v_et . ")</FONT></TD>\n\t\t</TR>";
    }
    flush();
    sleep(1);
    if ($conv == NULL) {
        echo "<TR>\n\t\t<TD class='tdleft'>ImageMagick</TD>\n\t\t<TD class='tdright'><a href='http://www.imagemagick.org/script/download.php'>wurde nicht gefunden</a></TD>\n\t\t</TR>";
    } else {
        $v_conv = shell_exec("convert -version");
        echo "<TR>\n\t\t<TD class='tdleft'>Convert</TD>\n\t\t<TD class='tdright'><FONT COLOR='green'>ist in " . $conv . " installiert (Ver. <a href='#' title = '{$v_conv}'>" . substr($v_conv, 20, 6) . "</a>)</FONT></TD>\n\t\t</TR>";
    }
    flush();
    sleep(1);
    if ($dc == NULL) {
        echo "<TR>\n\t\t<TD class='tdleft'>dcraw</TD>\n\t\t<TD class='tdright'><a href='http://www.cybercom.net/~dcoffin/dcraw/dcraw.c'>wurde nicht gefunden</a></TD>\n\t\t</TR>";
    } else {
        $v_dc = shell_exec("dcraw");
        echo "<TR>\n\t\t<TD class='tdleft'>dcraw</TD>\n\t\t<TD class='tdright'><FONT COLOR='green'>ist in " . $dc . " installiert (Ver. " . substr($v_dc, 28, 4) . ")</FONT></TD>\n\t\t</TR>";
        //Die von ImageMagick unterstuetzten Dateiformate werden ermittelt und in die DB geschrieben:
        $conv = buildConvertCommand($sr);
        $identify = str_replace('convert', 'identify', $conv);
        $sup_ft_arr = explode(chr(10), shell_exec($identify . " -list format"));
        //Array der unterstuetzten Dateiformate, Zeilentrennung
        //print_r($sup_ft_arr);
    }
    flush();
    sleep(1);
    if ($gb == NULL) {
        echo "<TR>\n\t\t<TD class='tdleft'>GPSBabel</TD>\n\t\t<TD class='tdright'><a href='http://www.gpsbabel.org/download.html'>wurde nicht gefunden</a></TD>\n\t\t</TR>";
    } else {
        $v_gb = shell_exec("gpsbabel -V");
        echo "<TR>\n\t\t<TD class='tdleft'>GPSBabel</TD>\n\t\t<TD class='tdright'><FONT COLOR='green'>ist in " . $gb . " installiert (Ver. " . substr($v_gb, 18, 5) . ")</FONT></TD>\n\t\t</TR>";
    }
    flush();
    sleep(1);
    if ($md == NULL) {
        echo "<TR>\n\t\t<TD class='tdleft'>md5sum</TD>\n\t\t<TD class='tdright'><a href='http://www.gnu.org/software/coreutils/'>wurde nicht gefunden</a></TD>\n\t\t</TR>";
    } else {
        $v_md = shell_exec("md5sum --version");
        echo "<TR>\n\t\t<TD class='tdleft'>md5sum</TD>\n\t\t<TD class='tdright'><FONT COLOR='green'>ist in " . $md . " installiert (Ver. " . substr($v_md, 23, 3) . ")</FONT></TD>\n\t\t</TR>";
    }
    flush();
    sleep(1);
    //Speicherung der Software-Pfade in der Tabelle 'pfade':
    $result1 = mysql_query("DELETE FROM {$table16}");
    echo mysql_error();
    $result2 = mysql_query("INSERT INTO {$table16} (dcraw_path, conv_path, et_path, gpsb_path, md5sum_path)\n\tVALUES ('{$dc}', '{$conv}', '{$et}', '{$gb}', '{$md}')");
    echo mysql_error();
    echo "\t<TR class='trflach'>\n\t\t<TD colspan='2'></TD>\n\t\t</TR>\n\t\t</TABLE>\n\t\t\n\t\t<CENTER>\n\t\t<TABLE style='width:500px; text-align:center;'>\n\t\t<TR>\n\t\t<TD><BR><u>WICHTIGER HINWEIS:</u><BR>Sollte eine der gelisteten Software-Komponenten nicht installiert sein, \n\t\tholen Sie dies bitte <b>VOR</b> der ersten Benutzung von pic2base nach.<BR>\n\t\tAnderenfalls werden einige Funktionen fehlen oder fehlerhaft sein!<BR>\n\t\t</TD>\n\t\t</TR>\n\t\t</TABLE>\n\t\t</CENTER>";
}