Code formatting.
This commit is contained in:
@@ -1,89 +1,84 @@
|
||||
<?php
|
||||
|
||||
if ('will' == $_GET['t']) {
|
||||
$path = "../img/will/";
|
||||
echo "<h2>Fotos auf der Seite Willkommen</h2>\n";
|
||||
} elseif ('haus' == $_GET['t']) {
|
||||
$path = "../img/haus/";
|
||||
echo "<h2>Fotos auf der Seite Unser Haus</h2>\n";
|
||||
} elseif ('lage' == $_GET['t']) {
|
||||
$path = "../img/haus/lage/";
|
||||
echo "<h2>Fotos auf der Seite Unser Haus - Lage</h2>\n";
|
||||
} elseif ('geschichte' == $_GET['t']) {
|
||||
$path = "../img/haus/geschichte/";
|
||||
echo "<h2>Fotos auf der Seite Unser Haus - Geschichte</h2>\n";
|
||||
} elseif ('gaby' == $_GET['t']) {
|
||||
$path = "../img/gaby/";
|
||||
echo "<h2>Fotos auf der Seite Wohnung Gaby</h2>\n";
|
||||
} elseif ('amelie' == $_GET['t']) {
|
||||
$path = "../img/amelie/";
|
||||
echo "<h2>Fotos auf der Seite Wohnung Amelie</h2>\n";
|
||||
}
|
||||
if ('will' == $_GET['t']) {
|
||||
$path = "../img/will/";
|
||||
echo "<h2>Fotos auf der Seite Willkommen</h2>\n";
|
||||
} elseif ('haus' == $_GET['t']) {
|
||||
$path = "../img/haus/";
|
||||
echo "<h2>Fotos auf der Seite Unser Haus</h2>\n";
|
||||
} elseif ('lage' == $_GET['t']) {
|
||||
$path = "../img/haus/lage/";
|
||||
echo "<h2>Fotos auf der Seite Unser Haus - Lage</h2>\n";
|
||||
} elseif ('geschichte' == $_GET['t']) {
|
||||
$path = "../img/haus/geschichte/";
|
||||
echo "<h2>Fotos auf der Seite Unser Haus - Geschichte</h2>\n";
|
||||
} elseif ('gaby' == $_GET['t']) {
|
||||
$path = "../img/gaby/";
|
||||
echo "<h2>Fotos auf der Seite Wohnung Gaby</h2>\n";
|
||||
} elseif ('amelie' == $_GET['t']) {
|
||||
$path = "../img/amelie/";
|
||||
echo "<h2>Fotos auf der Seite Wohnung Amelie</h2>\n";
|
||||
}
|
||||
|
||||
$ref = "index.php?section=fotos&t=".$_GET['t'];
|
||||
|
||||
if (!isset($_GET['action'])) {
|
||||
echo "<p>Auf ein vorhandenes Bild klicken um es zu löschen<br />";
|
||||
echo "Auf einen Platzhalter klicken um ein neues Bild hochzuladen</p>";
|
||||
for ($i=0; $i<10; $i++) {
|
||||
$pic = $path.$i.".jpg";
|
||||
if (file_exists($pic)) {
|
||||
$link = $ref."&action=del&pic=".$i;
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
|
||||
echo "</a>\n";
|
||||
}
|
||||
else {
|
||||
$link = $ref."&action=add&pic=".$i;
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"../img/no.jpg\" />";
|
||||
echo "</a>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ('del' == $_GET['action']) {
|
||||
$delfile = $path . $_GET['pic'] . ".jpg";
|
||||
if (unlink($delfile)) {
|
||||
echo "<p>Bild gelöscht</p>";
|
||||
}
|
||||
else {
|
||||
echo "<p>Fehler beim Löschen</p>";
|
||||
}
|
||||
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zurück zur Übersicht</a>\n";
|
||||
}
|
||||
elseif ('add' == $_GET['action']) {
|
||||
$ref .= "&action=speichern&pic=".$_GET['pic']
|
||||
?>
|
||||
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
|
||||
<label>Foto auswählen</label>
|
||||
<input type="file" name="Foto" />
|
||||
<br />
|
||||
<input type="submit" name="Speichern" value="Speichern" />
|
||||
</form>
|
||||
$ref = "index.php?section=fotos&t=" . $_GET['t'];
|
||||
|
||||
<?php
|
||||
}
|
||||
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=480;
|
||||
$newwidth=($width/$height)*480;
|
||||
} else {
|
||||
$newwidth=480;
|
||||
$newheight=($height/$width)*480;
|
||||
}
|
||||
$tmp=imagecreatetruecolor($newwidth,$newheight);
|
||||
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
|
||||
$filename = $path . $_GET['pic'] . ".jpg";
|
||||
imagejpeg($tmp,$filename,80);
|
||||
imagedestroy($src);
|
||||
imagedestroy($tmp);
|
||||
unlink($path. $_FILES['Foto']['name']);
|
||||
echo "<p>Bild hochgeladen</p>";
|
||||
echo "<a href=\"index.php?section=fotos&t=".$_GET['t']."\">Zurück zur Übersicht</a>\n";
|
||||
}
|
||||
}
|
||||
if (!isset($_GET['action'])) {
|
||||
echo "<p>Auf ein vorhandenes Bild klicken um es zu l<>schen<br />";
|
||||
echo "Auf einen Platzhalter klicken um ein neues Bild hochzuladen</p>";
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$pic = $path . $i . ".jpg";
|
||||
if (file_exists($pic)) {
|
||||
$link = $ref . "&action=del&pic=" . $i;
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
|
||||
echo "</a>\n";
|
||||
} else {
|
||||
$link = $ref . "&action=add&pic=" . $i;
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"../img/no.jpg\" />";
|
||||
echo "</a>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ('del' == $_GET['action']) {
|
||||
$delfile = $path . $_GET['pic'] . ".jpg";
|
||||
if (unlink($delfile)) {
|
||||
echo "<p>Bild gel<65>scht</p>";
|
||||
} else {
|
||||
echo "<p>Fehler beim L<>schen</p>";
|
||||
}
|
||||
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zur<75>ck zur <20>bersicht</a>\n";
|
||||
} elseif ('add' == $_GET['action']) {
|
||||
$ref .= "&action=speichern&pic=" . $_GET['pic']
|
||||
?>
|
||||
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
|
||||
<label>Foto auswählen</label>
|
||||
<input type="file" name="Foto"/>
|
||||
<br/>
|
||||
<input type="submit" name="Speichern" value="Speichern"/>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
} 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 = 480;
|
||||
$newwidth = ($width / $height) * 480;
|
||||
} else {
|
||||
$newwidth = 480;
|
||||
$newheight = ($height / $width) * 480;
|
||||
}
|
||||
$tmp = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||
$filename = $path . $_GET['pic'] . ".jpg";
|
||||
imagejpeg($tmp, $filename, 80);
|
||||
imagedestroy($src);
|
||||
imagedestroy($tmp);
|
||||
unlink($path . $_FILES['Foto']['name']);
|
||||
echo "<p>Bild hochgeladen</p>";
|
||||
echo "<a href=\"index.php?section=fotos&t=" . $_GET['t'] . "\">Zur<75>ck zur <20>bersicht</a>\n";
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,13 @@
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_POST['add'])) {
|
||||
include "inhalte/fotos/bilder/add.php";
|
||||
}
|
||||
elseif (isset($_POST['edit'])) {
|
||||
include "inhalte/fotos/bilder/edit.php";
|
||||
}
|
||||
elseif (isset($_POST['del'])) {
|
||||
include "inhalte/fotos/bilder/del.php";
|
||||
}
|
||||
else {
|
||||
include "inhalte/fotos/bilder/standard.php";
|
||||
}
|
||||
if (isset($_POST['add'])) {
|
||||
include "inhalte/fotos/bilder/add.php";
|
||||
} elseif (isset($_POST['edit'])) {
|
||||
include "inhalte/fotos/bilder/edit.php";
|
||||
} elseif (isset($_POST['del'])) {
|
||||
include "inhalte/fotos/bilder/del.php";
|
||||
} else {
|
||||
include "inhalte/fotos/bilder/standard.php";
|
||||
}
|
||||
?>
|
||||
@@ -1,59 +1,58 @@
|
||||
<h3>Neues Bild hinzufügen</h3>
|
||||
<h3>Neues Bild hinzuf<EFBFBD>gen</h3>
|
||||
|
||||
<?php
|
||||
if (!isset($_POST['Speichern'])) {
|
||||
?>
|
||||
?>
|
||||
|
||||
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
|
||||
<label>Foto auswählen</label>
|
||||
<input type="hidden" name="add" value="speichern" />
|
||||
<input type="file" name="Foto" />
|
||||
<br />
|
||||
<label>Bildüberschrift</label>
|
||||
<input type="text" name="Text" />
|
||||
<br />
|
||||
<input type="submit" name="Speichern" value="Speichern" />
|
||||
</form>
|
||||
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
|
||||
<label>Foto auswählen</label>
|
||||
<input type="hidden" name="add" value="speichern"/>
|
||||
<input type="file" name="Foto"/>
|
||||
<br/>
|
||||
<label>Bild<EFBFBD>berschrift</label>
|
||||
<input type="text" name="Text"/>
|
||||
<br/>
|
||||
<input type="submit" name="Speichern" value="Speichern"/>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
if ('' != $_FILES['Foto']['name']) {
|
||||
$Text = $_POST['Text'];
|
||||
$sql1 = 'INSERT INTO bilder (ID, Head) VALUES (NULL, "'.$Text.'");';
|
||||
$stmt1 = $db->prepare($sql1);
|
||||
<?php
|
||||
} else {
|
||||
if ('' != $_FILES['Foto']['name']) {
|
||||
$Text = $_POST['Text'];
|
||||
$sql1 = 'INSERT INTO bilder (ID, Head) VALUES (NULL, "' . $Text . '");';
|
||||
$stmt1 = $db->prepare($sql1);
|
||||
if (!$stmt1) {
|
||||
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
|
||||
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
|
||||
}
|
||||
if (!$stmt1->execute()) {
|
||||
die ('Query konnte nicht ausgeführt werden: '.$stmt1->error);
|
||||
die ('Query konnte nicht ausgef<EFBFBD>hrt werden: ' . $stmt1->error);
|
||||
}
|
||||
|
||||
$sql2 = 'SELECT last_insert_id()';
|
||||
$result2 = $db->query($sql2);
|
||||
$last = $result2->fetch_assoc();
|
||||
$id = $last['last_insert_id()'];
|
||||
$sql2 = 'SELECT last_insert_id()';
|
||||
$result2 = $db->query($sql2);
|
||||
$last = $result2->fetch_assoc();
|
||||
$id = $last['last_insert_id()'];
|
||||
|
||||
$uploaddir = '../img/umgebung/bilder/';
|
||||
$uploadfile = $uploaddir. $_FILES['Foto']['name'];
|
||||
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
|
||||
$src = imagecreatefromjpeg($uploadfile);
|
||||
list($width,$height)=getimagesize($uploadfile);
|
||||
if ($height > $width) {
|
||||
$newheight=460;
|
||||
$newwidth=($width/$height)*460;
|
||||
} else {
|
||||
$newwidth=460;
|
||||
$newheight=($height/$width)*460;
|
||||
}
|
||||
$tmp=imagecreatetruecolor($newwidth,$newheight);
|
||||
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
|
||||
$filename = $uploaddir . $id . ".jpg";
|
||||
imagejpeg($tmp,$filename,80);
|
||||
imagedestroy($src);
|
||||
imagedestroy($tmp);
|
||||
unlink($uploaddir. $_FILES['Foto']['name']);
|
||||
}
|
||||
echo '<a href="index.php?section=fotos&t=bilder">Zurück zur Übersicht</a>';
|
||||
$uploaddir = '../img/umgebung/bilder/';
|
||||
$uploadfile = $uploaddir . $_FILES['Foto']['name'];
|
||||
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
|
||||
$src = imagecreatefromjpeg($uploadfile);
|
||||
list($width, $height) = getimagesize($uploadfile);
|
||||
if ($height > $width) {
|
||||
$newheight = 460;
|
||||
$newwidth = ($width / $height) * 460;
|
||||
} else {
|
||||
$newwidth = 460;
|
||||
$newheight = ($height / $width) * 460;
|
||||
}
|
||||
$tmp = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||
$filename = $uploaddir . $id . ".jpg";
|
||||
imagejpeg($tmp, $filename, 80);
|
||||
imagedestroy($src);
|
||||
imagedestroy($tmp);
|
||||
unlink($uploaddir . $_FILES['Foto']['name']);
|
||||
}
|
||||
echo '<a href="index.php?section=fotos&t=bilder">Zur<EFBFBD>ck zur <EFBFBD>bersicht</a>';
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,39 +1,37 @@
|
||||
<?php
|
||||
|
||||
if (!isset($_POST['Speichern'])) {
|
||||
echo "<p>Dieses Bild löschen?</p>\n";
|
||||
$file = "../img/umgebung/bilder/".$_POST['Titel'].".jpg";
|
||||
echo "<img src=\"$file\"><br />\n";
|
||||
$sql1 = 'SELECT * FROM bilder WHERE ID = "'.$_POST['Titel'].'"';
|
||||
$result1 = $db->query($sql1);
|
||||
$nt1 = $result1->fetch_assoc();
|
||||
echo "<h3>$nt1[Head]</h3>";
|
||||
?>
|
||||
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="del" value="speichern" />
|
||||
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>" />
|
||||
<input type="hidden" name="file" value="<?php echo $file; ?>" />
|
||||
<br />
|
||||
<input type="submit" name="Speichern" value="L<>schen" />
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
$sql2 = 'DELETE FROM bilder WHERE ID = "'.$_POST['id'].'"';
|
||||
$result2 = $db->query($sql2);
|
||||
if ($result2) {
|
||||
echo "<p>Datenbankeintrag gelöscht</p>\n";
|
||||
if (unlink($_POST['file'])) {
|
||||
echo "<p>Bild wurde gelöscht</p>\n";
|
||||
}
|
||||
else {
|
||||
echo "<p>Fehler beim Löschen des Bildes</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo "Fehler beim L<>schen";
|
||||
}
|
||||
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
|
||||
echo "<p>Dieses Bild löschen?</p>\n";
|
||||
$file = "../img/umgebung/bilder/" . $_POST['Titel'] . ".jpg";
|
||||
echo "<img src=\"$file\"><br />\n";
|
||||
$sql1 = 'SELECT * FROM bilder WHERE ID = "' . $_POST['Titel'] . '"';
|
||||
$result1 = $db->query($sql1);
|
||||
$nt1 = $result1->fetch_assoc();
|
||||
echo "<h3>$nt1[Head]</h3>";
|
||||
?>
|
||||
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="del" value="speichern"/>
|
||||
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>"/>
|
||||
<input type="hidden" name="file" value="<?php echo $file; ?>"/>
|
||||
<br/>
|
||||
<input type="submit" name="Speichern" value="L<>schen"/>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
$sql2 = 'DELETE FROM bilder WHERE ID = "' . $_POST['id'] . '"';
|
||||
$result2 = $db->query($sql2);
|
||||
if ($result2) {
|
||||
echo "<p>Datenbankeintrag gelöscht</p>\n";
|
||||
if (unlink($_POST['file'])) {
|
||||
echo "<p>Bild wurde gelöscht</p>\n";
|
||||
} else {
|
||||
echo "<p>Fehler beim Löschen des Bildes</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo "Fehler beim L<>schen";
|
||||
}
|
||||
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -3,36 +3,35 @@
|
||||
<?php
|
||||
|
||||
if (!isset($_POST['Speichern'])) {
|
||||
echo "<img src=\"../img/umgebung/bilder/".$_POST['Titel'].".jpg\" /><br />";
|
||||
$sql1 = 'SELECT Head FROM bilder WHERE ID = "'.$_POST['Titel'].'"';
|
||||
$result1 = $db->query($sql1);
|
||||
$nt1 = $result1->fetch_assoc();
|
||||
echo $nt1['Head'];
|
||||
echo "<img src=\"../img/umgebung/bilder/" . $_POST['Titel'] . ".jpg\" /><br />";
|
||||
$sql1 = 'SELECT Head FROM bilder WHERE ID = "' . $_POST['Titel'] . '"';
|
||||
$result1 = $db->query($sql1);
|
||||
$nt1 = $result1->fetch_assoc();
|
||||
echo $nt1['Head'];
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="edit" value="speichern" />
|
||||
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>" />
|
||||
<label>Bildüberschrift</label>
|
||||
<input type="text" name="Text" value="<?php echo $nt1['Head']; ?>" />
|
||||
<br />
|
||||
<input type="submit" name="Speichern" value="Speichern" />
|
||||
</form>
|
||||
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="edit" value="speichern"/>
|
||||
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>"/>
|
||||
<label>Bildüberschrift</label>
|
||||
<input type="text" name="Text" value="<?php echo $nt1['Head']; ?>"/>
|
||||
<br/>
|
||||
<input type="submit" name="Speichern" value="Speichern"/>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
$Text = $_POST['Text'];
|
||||
$sql2 = 'UPDATE bilder SET Head = "'.$Text.'" WHERE ID = "'.$_POST['id'].'";';
|
||||
$stmt2 = $db->prepare($sql2);
|
||||
if (!$stmt2) {
|
||||
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
|
||||
}
|
||||
if (!$stmt2->execute()) {
|
||||
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt->error);
|
||||
}
|
||||
echo "Die <20>berschrift wurde gespeichert<br />";
|
||||
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
|
||||
<?php
|
||||
} else {
|
||||
$Text = $_POST['Text'];
|
||||
$sql2 = 'UPDATE bilder SET Head = "' . $Text . '" WHERE ID = "' . $_POST['id'] . '";';
|
||||
$stmt2 = $db->prepare($sql2);
|
||||
if (!$stmt2) {
|
||||
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
|
||||
}
|
||||
if (!$stmt2->execute()) {
|
||||
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt->error);
|
||||
}
|
||||
echo "Die <20>berschrift wurde gespeichert<br />";
|
||||
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -3,30 +3,30 @@ $sql1 = 'SELECT * FROM bilder';
|
||||
$result1 = $db->query($sql1);
|
||||
?>
|
||||
<fieldset>
|
||||
<form action="index.php?section=fotos&t=bilder" method="post">
|
||||
<fieldset>
|
||||
<legend>neues Foto hochladen</legend>
|
||||
<input type="submit" name="add" value="Hochladen" />
|
||||
<br />
|
||||
</fieldset>
|
||||
<br />
|
||||
<select name="Titel">
|
||||
<?php
|
||||
while ($nt1 = $result1->fetch_assoc()) {
|
||||
echo '<option value="'.$nt1['ID'].'">'.$nt1['ID'].' '.$nt1['Head'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br />
|
||||
<fieldset>
|
||||
<legend>Bildüberschrift eines Fotos ändern</legend>
|
||||
<input type="submit" name="edit" value="Bearbeiten" />
|
||||
<br />
|
||||
</fieldset>
|
||||
<br />
|
||||
<fieldset>
|
||||
<legend>bestehendes Foto löschen</legend>
|
||||
<input type="submit" name="del" value="Löschen" />
|
||||
<br />
|
||||
</fieldset>
|
||||
<form action="index.php?section=fotos&t=bilder" method="post">
|
||||
<fieldset>
|
||||
<legend>neues Foto hochladen</legend>
|
||||
<input type="submit" name="add" value="Hochladen"/>
|
||||
<br/>
|
||||
</fieldset>
|
||||
<br/>
|
||||
<select name="Titel">
|
||||
<?php
|
||||
while ($nt1 = $result1->fetch_assoc()) {
|
||||
echo '<option value="' . $nt1['ID'] . '">' . $nt1['ID'] . ' ' . $nt1['Head'] . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br/>
|
||||
<fieldset>
|
||||
<legend>Bild<EFBFBD>berschrift eines Fotos <EFBFBD>ndern</legend>
|
||||
<input type="submit" name="edit" value="Bearbeiten"/>
|
||||
<br/>
|
||||
</fieldset>
|
||||
<br/>
|
||||
<fieldset>
|
||||
<legend>bestehendes Foto l<EFBFBD>schen</legend>
|
||||
<input type="submit" name="del" value="L<EFBFBD>schen"/>
|
||||
<br/>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
@@ -1,68 +1,65 @@
|
||||
<?php
|
||||
|
||||
$path = "../img/haus/wohn/";
|
||||
$ref = "index.php?section=fotos&t=".$_GET['t'];
|
||||
$ref = "index.php?section=fotos&t=" . $_GET['t'];
|
||||
|
||||
if (!isset($_GET['action'])) {
|
||||
echo "<p>Auf ein Bild klicken um es zu ersetzen<br />";
|
||||
echo "<p>Auf ein Bild klicken um es zu ersetzen<br />";
|
||||
|
||||
for ($i=0; $i<2; $i++) {
|
||||
$pic = $path.$i.".jpg";
|
||||
if (file_exists($pic)) {
|
||||
$link = $ref."&action=add&pic=".$i;
|
||||
if (0 == $i) {
|
||||
echo "<p>Wohnung Gaby:</p>\n";
|
||||
} else {
|
||||
echo "<p>Wohnung Amelie:</p>\n";
|
||||
}
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
|
||||
echo "</a>\n";
|
||||
echo "<br /> ";
|
||||
}
|
||||
else {
|
||||
$link = $ref."&action=add&pic=".$i;
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"border: 2px solid red;\" src=\"../img/no.jpg\" />";
|
||||
echo "</a>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ('add' == $_GET['action']) {
|
||||
$ref .= "&action=speichern&pic=".$_GET['pic']
|
||||
?>
|
||||
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
|
||||
<label>Foto auswählen</label>
|
||||
<input type="file" name="Foto" />
|
||||
<br />
|
||||
<input type="submit" name="Speichern" value="Speichern" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
elseif ('speichern' == $_GET['action']) {
|
||||
$delfile = $path . $_GET['pic'] . ".jpg";
|
||||
unlink($delfile);
|
||||
$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=200;
|
||||
$newwidth=($width/$height)*200;
|
||||
} else {
|
||||
$newwidth=200;
|
||||
$newheight=($height/$width)*200;
|
||||
}
|
||||
$tmp=imagecreatetruecolor($newwidth,$newheight);
|
||||
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
|
||||
$filename = $path . $_GET['pic'] . ".jpg";
|
||||
imagejpeg($tmp,$filename,80);
|
||||
imagedestroy($src);
|
||||
imagedestroy($tmp);
|
||||
unlink($path. $_FILES['Foto']['name']);
|
||||
echo "<p>Bild hochgeladen</p>";
|
||||
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zurück zur Übersicht</a>\n";
|
||||
}
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$pic = $path . $i . ".jpg";
|
||||
if (file_exists($pic)) {
|
||||
$link = $ref . "&action=add&pic=" . $i;
|
||||
if (0 == $i) {
|
||||
echo "<p>Wohnung Gaby:</p>\n";
|
||||
} else {
|
||||
echo "<p>Wohnung Amelie:</p>\n";
|
||||
}
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
|
||||
echo "</a>\n";
|
||||
echo "<br /> ";
|
||||
} else {
|
||||
$link = $ref . "&action=add&pic=" . $i;
|
||||
echo "<a href=\"$link\">";
|
||||
echo "<img style=\"border: 2px solid red;\" src=\"../img/no.jpg\" />";
|
||||
echo "</a>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ('add' == $_GET['action']) {
|
||||
$ref .= "&action=speichern&pic=" . $_GET['pic']
|
||||
?>
|
||||
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
|
||||
<label>Foto auswählen</label>
|
||||
<input type="file" name="Foto"/>
|
||||
<br/>
|
||||
<input type="submit" name="Speichern" value="Speichern"/>
|
||||
</form>
|
||||
<?php
|
||||
} elseif ('speichern' == $_GET['action']) {
|
||||
$delfile = $path . $_GET['pic'] . ".jpg";
|
||||
unlink($delfile);
|
||||
$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 = 200;
|
||||
$newwidth = ($width / $height) * 200;
|
||||
} else {
|
||||
$newwidth = 200;
|
||||
$newheight = ($height / $width) * 200;
|
||||
}
|
||||
$tmp = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||
$filename = $path . $_GET['pic'] . ".jpg";
|
||||
imagejpeg($tmp, $filename, 80);
|
||||
imagedestroy($src);
|
||||
imagedestroy($tmp);
|
||||
unlink($path . $_FILES['Foto']['name']);
|
||||
echo "<p>Bild hochgeladen</p>";
|
||||
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zur<75>ck zur <20>bersicht</a>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user