query($sql); $nt = $result->fetch_assoc(); echo "
\n"; echo " Bilder zum Fahrzeug:\n"; if ('del' == $_GET['action']) { $delfile = $path . $_GET['kfz'] . "_" . $_GET['pic'] . ".jpg"; $delthumb = $path . $_GET['kfz'] . "_" . $_GET['pic'] . "_thumb.jpg"; if (unlink($delfile)) { if (unlink($delthumb)) { echo "

Bild gelöscht

"; } } else { echo "

Fehler beim Löschen

"; } echo 'Fotos bearbeiten'; } elseif ('add' == $_GET['action']) { $ref .= "&action=speichern&pic=" . $_GET['pic']; echo "
\n"; echo " \n"; echo " \n"; echo "
\n"; echo " \n"; echo "
\n"; } elseif ('speichern' == $_GET['action']) { $uploadfile = $path . $_FILES['Foto']['name']; move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile); $src = imagecreatefromjpeg($uploadfile); list($width, $height) = getimagesize($uploadfile); if ($height > $width) { $newheight = $large; $thumbheight = $small; $newwidth = ($width / $height) * $large; $thumbwidth = ($width / $height) * $small; } else { $newwidth = $large; $thumbwidth = $small; $newheight = ($height / $width) * $large; $thumbheight = ($height / $width) * $small; } $tmp = imagecreatetruecolor($newwidth, $newheight); $tmp_thumb = imagecreatetruecolor($thumbwidth, $thumbheight); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagecopyresampled($tmp_thumb, $src, 0, 0, 0, 0, $thumbwidth, $thumbheight, $width, $height); $filename = $path . $_GET['kfz'] . "_" . $_GET['pic'] . ".jpg"; $thumbname = $path . $_GET['kfz'] . "_" . $_GET['pic'] . "_thumb.jpg"; imagejpeg($tmp, $filename, 90); imagejpeg($tmp_thumb, $thumbname, 90); imagedestroy($src); imagedestroy($tmp); imagedestroy($tmp_thumb); unlink($path . $_FILES['Foto']['name']); chmod($filename, 0755); echo "

Bild hochgeladen

"; echo 'Fotos bearbeiten'; } else { echo "

Klicken Sie auf ein vorhandenes Bild um es zu löschen. Zum Hochladen eines neuen Bildes klicken Sie auf einen Platzhalter.

\n"; echo "
\n"; echo "
\n"; echo " Bilder für die Homepage\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; for ($i = 0; $i < 8; $i++) { $pic = $path . $id . "_" . $i . "_thumb.jpg"; if ((2 == $i) OR (4 == $i) OR (6 == $i)) { echo " \n"; echo " \n"; } if (file_exists($pic)) { $link = $ref . "&action=del&pic=" . $i; echo " \n"; } else { $link = $ref . "&action=add&pic=" . $i; echo " \n"; } } echo " \n"; echo "
\n"; echo " "; echo ""; echo "\n"; echo "
\n"; echo " \n"; echo "
\n"; echo " "; echo ""; echo "\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " Bilder zur internen Verwendung\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; for ($i = 8; $i < 10; $i++) { $pic = $path . $id . "_" . $i . "_thumb.jpg"; if (file_exists($pic)) { $link = $ref . "&action=del&pic=" . $i; echo " \n"; } else { $link = $ref . "&action=add&pic=" . $i; echo " \n"; } } echo " \n"; echo "
\n"; echo " "; echo ""; echo "\n"; echo " \n"; echo " "; echo ""; echo "\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " Bildbeschreibungen Speichern und Fahrzeug anzeigen\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; } echo "
\n";