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"]; $curnumber = -1; for($i = 0; $i < $anz; $i++) { if (isset($_POST["image".$i]) && !empty($_POST["image".$i])) { $screenshotTmp = $_POST["image".$i]; $fileTmpUpload = $dirPath . "/sc-" . $gebietid . "-" . $side . ".png." . $_SESSION["email"] . "-part" . $i; $successTmpUpload = file_put_contents($fileTmpUpload, $screenshotTmp); $curnumber = $i; break; } } echo "$curnumber, $anz"; if ($curnumber == $anz - 1) // alle Teile hochgeladen { for($i = 0; $i < $anz; $i++) { $fileTmpUpload = $dirPath . "/sc-" . $gebietid . "-" . $side . ".png." . $_SESSION["email"] . "-part" . $i; $screenshot .= file_get_contents($fileTmpUpload); unlink($fileTmpUpload); } //$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] - 10; //-10 wg. Scrollbar $orgHeight = $xy_org[1] - 10; //-10 wg. Scrollbar $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 "Teilupload erfolgreich $curnumber von $anz"; } } else { echo "Fehler: Verzeichnis nicht gefunden!"; } } else { echo "Fehler: Seite wurde nicht angegeben!"; //phpinfo(); } } else { file_put_contents ( "stuzi_upload_not_loggedon.txt" , date("Y-m-d H:i:s") ); echo "Fehler: Sie haben keine Berechtigung!"; } ?>