Lesen aus Session $versammlungid = $_SESSION["uploadversammlungid"]; $gebietid = $_SESSION["uploadgebietid"]; if (empty($versammlungid) || empty($gebietid)) { echo "Es wurde kein Gebiet für den Upload ausgewählt!"; } else if ($side == "front" || $side == "back") { $dirPath = "screenshotsGebiete/" . $versammlungid; if (!file_exists($dirPath)) { mkdir($dirPath); } if (file_exists($dirPath) && is_dir($dirPath)) { //echo "Starte Verarbeitung Bild!"; $screenshot = ""; $anz = $_POST["anz"]; for($i = 0; $i < $anz; $i++) { $screenshot .= $_POST["image".$i]; } //$screenshot = str_replace('data:image/jpeg;base64,', '', $screenshot); $screenshot = str_replace('data:image/png;base64,', '', $screenshot); $screenshot = str_replace(' ', '+', $screenshot); $data = base64_decode($screenshot); $file = $dirPath . "/sc-" . $gebietid . "-" . $side . ".png"; $success = file_put_contents($file, $data); /// Zuschneiden $org_img = $file; $dst_img = $file; $xy_org = getimagesize($org_img); $orgWidth = $xy_org[0]; $orgHeight = $xy_org[1]; $x_new = 10; $y_new = 10; $newWidth = 210*$orgHeight/148; if ($newWidth > $orgWidth) { $newHeight = 148*$orgWidth/210; $x_new = $orgWidth; $y_new = $newHeight; } else { $x_new = $newWidth; $y_new = $orgHeight; } $tmp_img = imagecreatetruecolor($x_new-4, $y_new-4); $src_img = imagecreatefrompng($org_img); imagecopy($tmp_img, $src_img, 0, 0, 0, 0, $x_new-4, $y_new-4); // Text hinzufügen $color = ImageColorAllocate ($tmp_img, 0, 0, 0); putenv('GDFONTPATH=' . realpath('.')); imagettftext($tmp_img , 20 , 0 , 0 , 0 , $color , "font_RomanFixed" , "001 Gebiet 01" ); imagepng($tmp_img, $dst_img, 0); imagedestroy($tmp_img); /// Ende Zuschneiden //echo $file; echo "Upload erfolgreich " . $anz; } else { echo "Fehler: Verzeichnis nicht gefunden!"; } } else { echo "Fehler: Seite wurde nicht angegeben!"; phpinfo(); } } else { echo "Fehler: Sie haben keine Berechtigung!"; } ?>