Commit 2dd42586 by sn

Image

1 parent f185aa1c
......@@ -321,33 +321,39 @@ class D {
self::new_echo('<h1>backtrace('.$class.')</h1>', $param_print, $param_force);
$array = debug_backtrace();
$k=0;
$table_start = '<table border="1">' ;
$table_start .= '<tr valign="top"><td align="right">Klasse</td><td>Funktion</td><td>Datei</td></tr>';
self::new_echo($table_start, $param_print, $param_force);
for($i=count($array)-1; $i!=0; $i--) {
$k++;
$ul_start="";
$ul_end="";
// for($j=0; $j<$k; $j++) {
// $ul_start .= "<ul>";
// $ul_end .= "</ul>";
// }
$var_string = $ul_start."" .
"<li><strong style=\"font-size:12;color:gray;\"><b>" ;
$var_string = '<tr valign="top">';
$var_string .= '<td align="right">';
if(array_key_exists('class', $array[$i]) && array_key_exists('type', $array[$i])) {
$var_string .= "<strong style=\"color:black;\">".$array[$i]["class"].$array[$i]["type"].'</strong>';
$var_string .= "".$array[$i]["class"].$array[$i]["type"].'';
}
$var_string .= '</td>';
$var_string .= '<td>';
$var_string .= $array[$i]["function"]."(...) ";
$var_string .=
"</b> ... Funktion wird aufgerufen in der Zeile ".$array[$i]["line"]." " .
"in der Datei <i title=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</i>" .
"</strong></li>".$ul_end;
$var_string .= " ... fnc call in row ".$array[$i]["line"]." " .
// "in der Datei <a title=\"".$array[$i]["file"]."\" href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a>" .
// "in der Datei <a title=\"".$array[$i]["file"]."\" href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a>" .
// "in der Datei <a title=\"".$array[$i]["file"]."\" href=\"".$array[$i]["file"]."\">".basename($array[$i]["file"])."</a>" .
"";
// echo($var_string);
$var_string .= '</td>';
$var_string .= '<td><span style=\"font-size:6;\">'. dirname($array[$i]["file"]).'/<b>'.basename($array[$i]["file"]).'</b></span></td>';
$var_string .= '</tr>';
self::new_echo($var_string, $param_print, $param_force);
}
$table_stop = '</table>' ;
self::new_echo($table_stop, $param_print, $param_force);
}
/**
......
......@@ -72,6 +72,24 @@ class mcFile {
public static function deleteFile($param_filename) {
return unlink($param_filename);
}
public static function rename($param_from, $param_to){
//file_exists() - Existenz der Datei prüfen
if(!file_exists($param_to)){
return rename($param_from, $param_to);
// //copy() - Datei kopieren
// if (!copy($from, $to)) {
// print ("failed to copy $file...<br>\n");
// }
// else{
// //unlink() - Datei löschen
// unlink($from);
// }
} else {
return false;
}
}
}
?>
<?php
class mcImage {
/**
*
* @param string $param_svgFileString
*/
public static function pngToJpg($param_in_png, $param_out_jpg=false, $param_quality=100) {
if($param_out_jpg === false) {
$param_out_jpg = tempnam("/tmp", "mcImage_");
$tmp_jpg = $param_out_jpg.'.jpg';
mcFile::rename($param_out_jpg, $tmp_jpg);
$param_out_jpg = $tmp_jpg;
}
$shell_exec = mcImage::GD_pngToJpg($param_in_png, $param_out_jpg, $param_quality);
// D::show($shell_exec);
if($shell_exec) {
return $param_out_jpg;
} else {
return false;
}
}
/**
*
* GD library
*
* @param type $originalFile
* @param type $outputFile
* @param type $quality - Quality is a number between 0 (best compression) and 100 (best quality)
*/
protected static function GD_pngToJpg($originalFile, $outputFile, $quality) {
$image = imagecreatefrompng($originalFile);
$return = imagejpeg($image, $outputFile, $quality);
imagedestroy($image);
return $return;
}
}
?>
......@@ -10,6 +10,9 @@ class mcInkscape {
if($param_out_png === false) {
$param_out_png = tempnam("/tmp", "mcInkscape_");
$tmp_png = $param_out_png.'.png';
mcFile::rename($param_out_png, $tmp_png);
$param_out_png = $tmp_png;
}
$inkscape_order = "inkscape $param_in_svg -e $param_out_png";
......@@ -19,6 +22,13 @@ class mcInkscape {
return $param_out_png;
}
public static function svgToJpg($param_in_svg, $param_out_jpg=false, $param_quality=100) {
$new_png = mcInkscape::svgToPng($param_in_svg);
// D::li('1.1 $new_png: '.$new_png);
return mcImage::pngToJpg($new_png, $param_out_jpg, $param_quality);
}
}
?>
\ No newline at end of file
......@@ -24,7 +24,9 @@
require_once $__PATH_to_mcClasses . 'class_mcMail.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcConfig.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcFile.inc.php';
require_once $__PATH_to_mcClasses . 'file/class_mcFile.inc.php';
require_once $__PATH_to_mcClasses . 'file/class_mcInkscape.inc.php';
require_once $__PATH_to_mcClasses . 'file/class_mcImage.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcCONST.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcCsv.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcDeprecated.inc.php';
......@@ -36,7 +38,7 @@ require_once $__PATH_to_mcClasses . 'oop/class_mcObjectStatistic.inc.php';
require_once $__PATH_to_mcClasses . 'oop/if_mcClass.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcSort.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcInkscape.inc.php';
//require_once $__PATH_to_mcClasses . 'class_.inc.php';
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!