vraagje over fotoalbum

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Erika

erika

16/09/2007 21:01:00
Quote Anchor link
hallo

ik heb een vraagje
er is iemand voor mijn zo vriendelijk geweest een script te maken voor een fotoalbum met tekst.
Alleen het punt nu is dat de tekst naast de foto komt te staan en zou het graag onder de foto willen.
Alleen diegene die hem voor mijn gemaakt heeft, heeft het nu te druk.
Weet iemand hier een oplossing want zou graag me foto;s er op willen zetten

dit is het page gedeelte
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
+---------------------------------------+
| Photo Explorer v0.1 |
+---------------------------------------+
*/
// De albumconfiguratie

$width = 690; // Hier geven we aan hoe breed de gallery moet worden
$thumbnails_per_row = 5; // Het aantal thumbnails per rij
$thumbnail_indexing = TRUE; // De thumbnails worden automatisch geïndexeerd
$thumbnails_per_page = 15; // Het aantal thumbnails per pagina

$thumbnail_filetype = "jpg";// Je kunt hier aangeven of het png of jpg moet wezen
$slideshow_filetype = "jpg";// Ook hier kun je aangeven of het png of jpg moet wezen

$multipleGalleries = FALSE; // Meerder galleries of 'FALSE' is één gallerie

/*
Nu gaan we de gallerijen aanmaken. Tussen de eerste "" staat de naam van de gallerij, deze wordt
ook weergegeven in de navigatiebalk. Tussen de tweede "" na => vul je de naam van de map in waar de
images op je server staan.
*/

$galleries = array("bergonzoni" => "photoalbum bergonzoni/");
$link_original_image = FALSE; // De link naar het originele imagebestand activeren. FALSE is de-activeren

// !! Voordat je aan onderstaande configuratie gaat sleutelen is het aanbevolen EERST alle images uit de gallerij te verwijderen!!

// De slideshow configuratie

$image_margin = 10;
$image_border = FALSE;
$image_dropShadow = FALSE;
$image_offset_x = 1;
$image_offset_y = 1;
$image_dropShadow_scale = 0.99;
$image_dropShadow_offset = 6;
$image_dropShadow_blurRadius= 6; // Deze niet groter maken dan 46 en niet groter dan $dropShadow_offset anders ziet het er niet uit!

// De thumbnail configuratie

$thumbnail_border = FALSE;
$thumbnail_dropShadow = FALSE;
$thumbnail_offset_x = 0;
$thumbnail_offset_y = 1;
$thumbnail_dropShadow_scale = 0.99;
$thumbnail_dropShadow_offset= 6;
$thumbnail_dropShadow_blurRadius = 6;

$background_color = array(255, 255, 255);
$border_color = array(0, 0, 0);
$dropShadow_color = array(100, 100, 100); // Deze moet donkerder zijn dan de $background_color!!

$html_background_color = "#".sprintf("%02s", dechex($background_color[0])) .sprintf("%02s", dechex($background_color[1])).sprintf("%02s", dechex($background_color[2]));
?>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
// De initialisatie

$SCRIPT_NAME = getenv("SCRIPT_NAME");
if (isset($_GET["gallery"])) { $gallery = $_GET["gallery"]; }
else { $gallery = $galleries[key($galleries)]; }
if (isset($_GET["view"])) { $view = $_GET["view"]; }
else { $view = "thumbnails"; }

if (isset($_GET["thumbnail_index"])) { $thumbnail_index = $_GET["thumbnail_index"]; }
else { $thumbnail_index = 0; }

if (isset($_GET["slideshow_index"])) { $slideshow_index = $_GET["slideshow_index"]; }
else { $slideshow_index = 0; }

if (!is_dir($gallery)) { die("<br/><br/>ERROR: invalid directory: $gallery"); }
if (!is_dir($gallery."/.thumbs")) if (!mkdir($gallery."/.thumbs")) { die("<br/><br/>ERROR: can't create thumbnail directory in $gallery"); }
if (!is_dir($gallery."/.modified")) if (!mkdir($gallery."/.modified")) { die("<br/><br/>ERROR: can't create directory for modified images in $gallery"); }

$thumbnail_size = intval($width/$thumbnails_per_row);

// De functies

function scale_image($img, $factor) {
$temp = imagecreatetruecolor(imagesx($img)*$factor, imagesy($img)*$factor);
imagecopyresized($temp, $img, 0, 0, 0, 0, imagesx($img)*$factor, imagesy($img)*$factor, imagesx($img), imagesy($img));
return $temp;
imagedestroy($temp);
}

function
draw_image_border($img) {
imagerectangle($img, 0, 0, imagesx($img)-1, imagesy($img)-1, imagecolorresolve($img, $GLOBALS["border_color"][0], $GLOBALS["border_color"][1], $GLOBALS["border_color"][2]));
return $img;
}

function
draw_dropShadow($img, $dropShadow_scale, $dropShadow_offset, $dropShadow_blurRadius, $background_color, $dropShadow_color, $image_offset_x, $image_offset_y) {

$dropShadow_width = intval(imagesx($img)*$dropShadow_scale);
$dropShadow_height = intval(imagesy($img)*$dropShadow_scale);

$img_dropShadow = imagecreatetruecolor($dropShadow_width+$dropShadow_offset+$dropShadow_blurRadius, $dropShadow_height+$dropShadow_offset+$dropShadow_blurRadius);

// gradient voor de schaduw genereren

$gradient_steps = array();
$temp_color = array();
$dropShadowGradientColors = array();

for ($i=0; $i<=2; $i++) {
$gradient_steps[$i] = ($background_color[$i]-$dropShadow_color[$i])/$dropShadow_blurRadius;
}


$temp_color[0] = $dropShadow_color[0]+$gradient_steps[0]/2;
$temp_color[1] = $dropShadow_color[1]+$gradient_steps[1]/2;
$temp_color[2] = $dropShadow_color[2]+$gradient_steps[2]/2;
$dropShadowGradientColors[0] = imagecolorresolve($img_dropShadow, $temp_color[0], $temp_color[1], $temp_color[2]);

for ($i=1; $i<$dropShadow_blurRadius; $i++) {
$temp_color[0] = $temp_color[0]+$gradient_steps[0];
$temp_color[1] = $temp_color[1]+$gradient_steps[1];
$temp_color[2] = $temp_color[2]+$gradient_steps[2];
$dropShadowGradientColors[$i] = imagecolorresolve($img_dropShadow, $temp_color[0], $temp_color[1], $temp_color[2]);
}


// Schaduw tekenen

imagefill($img_dropShadow, 0, 0, imagecolorresolve($img_dropShadow, $background_color[0], $background_color[1], $background_color[2]));
imagefilledrectangle($img_dropShadow, $dropShadow_offset+1, $dropShadow_offset+1, $dropShadow_offset+$dropShadow_width-1, $dropShadow_offset+$dropShadow_height-1, imagecolorresolve($img, $dropShadow_color[0], $dropShadow_color[1], $dropShadow_color[2]));

for ($i=0; $i<$dropShadow_blurRadius; $i++) {
// borders: top / left / right / bottom
imageline($img_dropShadow, $dropShadow_offset, $dropShadow_offset-$i, $dropShadow_offset+$dropShadow_width, $dropShadow_offset-$i, $dropShadowGradientColors[$i]);
imageline($img_dropShadow, $dropShadow_offset-$i, $dropShadow_offset, $dropShadow_offset-$i, $dropShadow_offset+$dropShadow_height, $dropShadowGradientColors[$i]);
imageline($img_dropShadow, $dropShadow_offset+$dropShadow_width+$i, $dropShadow_offset, $dropShadow_offset+$dropShadow_width+$i, $dropShadow_offset+$dropShadow_height, $dropShadowGradientColors[$i]);
imageline($img_dropShadow, $dropShadow_offset, $dropShadow_offset+$dropShadow_height+$i, $dropShadow_offset+$dropShadow_width, $dropShadow_offset+$dropShadow_height+$i, $dropShadowGradientColors[$i]);
// hoeken: left top / right top / left bottom / right bottom
imagearc($img_dropShadow, $dropShadow_offset+$dropShadow_blurRadius-$i, $dropShadow_offset+$dropShadow_blurRadius-$i, 2*$dropShadow_blurRadius, 2*$dropShadow_blurRadius, 180, 270, $dropShadowGradientColors[$i]);
imagearc($img_dropShadow, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_width, $dropShadow_offset+$dropShadow_blurRadius-$i, 2*$dropShadow_blurRadius, 2*$dropShadow_blurRadius, 270, 0, $dropShadowGradientColors[$i]);
imagearc($img_dropShadow, $dropShadow_offset+$dropShadow_blurRadius-$i, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_height, 2*$dropShadow_blurRadius, 2*$dropShadow_blurRadius, 90,180, $dropShadowGradientColors[$i]);
imagearc($img_dropShadow, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_width, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_height, 2*$dropShadow_blurRadius, 2*$dropShadow_blurRadius, 0, 90, $dropShadowGradientColors[$i]);
// alle hoeken nogmaals met 1px vergroot, leuk effect
imagearc($img_dropShadow, $dropShadow_offset+$dropShadow_blurRadius-$i, $dropShadow_offset+$dropShadow_blurRadius-$i, 2*$dropShadow_blurRadius+1, 2*$dropShadow_blurRadius+1, 180, 270, $dropShadowGradientColors[$i]);
imagearc($img_dropShadow, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_width, $dropShadow_offset+$dropShadow_blurRadius-$i, 2*$dropShadow_blurRadius+1, 2*$dropShadow_blurRadius+1, 270, 0, $dropShadowGradientColors[$i]);
imagearc($img_dropShadow, $dropShadow_offset+$dropShadow_blurRadius-$i, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_height, 2*$dropShadow_blurRadius+1, 2*$dropShadow_blurRadius+1, 90,180, $dropShadowGradientColors[$i]);
imagearc($img_dropShadow, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_width, $dropShadow_offset-$dropShadow_blurRadius+$i+$dropShadow_height, 2*$dropShadow_blurRadius+1, 2*$dropShadow_blurRadius+1, 0, 90, $dropShadowGradientColors[$i]);
}


imagecopy($img_dropShadow, $img, $image_offset_x, $image_offset_y, 0, 0, imagesx($img), imagesy($img));

return $img_dropShadow;
imagedestroy($img_dropShadow);
}

function
create_thumbnail($image) {

$thumbnail_size=$GLOBALS["thumbnail_size"];

$image_properties=getimagesize($image);
switch ($image_properties[2]) {
case
1: $thumb = imagecreatefromgif($image);break;
case
2: $thumb = imagecreatefromjpeg($image);break;
case
3: $thumb = imagecreatefrompng($image);break;
default:
die("<br/><br/>onbekend bestandstype: $image");
}


$temp = imagecreatetruecolor($thumbnail_size, $thumbnail_size);
imagefill($temp, 0, 0, imagecolorresolve($temp, $GLOBALS["background_color"][0], $GLOBALS["background_color"][1], $GLOBALS["background_color"][2]));

if ($image_properties[0]>$image_properties[1]) {
$thumb = scale_image($thumb, (1/($image_properties[0]/$thumbnail_size)*0.93));
if ($GLOBALS["thumbnail_border"]) { $thumb = draw_image_border($thumb); }
if ($GLOBALS["thumbnail_dropShadow"]) { $thumb = draw_dropShadow($thumb, $GLOBALS["thumbnail_dropShadow_scale"], $GLOBALS["thumbnail_dropShadow_offset"], $GLOBALS["thumbnail_dropShadow_blurRadius"], $GLOBALS["background_color"], $GLOBALS["dropShadow_color"], $GLOBALS["thumbnail_offset_x"], $GLOBALS["thumbnail_offset_y"]); }
imagecopy($temp, $thumb, 1, $thumbnail_size/2-imagesy($thumb)/2, 0, 0, imagesx($thumb), imagesy($thumb));
}

else {
$thumb = scale_image($thumb, (1/($image_properties[1]/$thumbnail_size)*0.93));
if ($GLOBALS["thumbnail_border"]) { $thumb = draw_image_border($thumb); }
if ($GLOBALS["thumbnail_dropShadow"]) { $thumb = draw_dropShadow($thumb, $GLOBALS["thumbnail_dropShadow_scale"], $GLOBALS["thumbnail_dropShadow_offset"], $GLOBALS["thumbnail_dropShadow_blurRadius"], $GLOBALS["background_color"], $GLOBALS["dropShadow_color"], $GLOBALS["thumbnail_offset_x"], $GLOBALS["thumbnail_offset_y"]); }
imagecopy($temp, $thumb, $thumbnail_size/2-imagesx($thumb)/2, 1, 0, 0, imagesx($thumb), imagesy($thumb));
}


switch ($GLOBALS["thumbnail_filetype"]) {
case
"png": {
imagepng($temp, "./.thumbs/$thumbnail_size"."_thumb_".$image.".".$GLOBALS["thumbnail_filetype"]);
}

break;
case
"jpg": {
imagejpeg($temp, "./.thumbs/$thumbnail_size"."_thumb_".$image.".".$GLOBALS["thumbnail_filetype"]);
}

break;
default: {

die("<br/><br/>ERROR: Dit bestandstype wordt niet ondersteund voor thumbnails: ".$GLOBALS["thumbnail_filetype"]);
}
}


imagedestroy($thumb);
imagedestroy($temp);
return TRUE;
}

function
create_slideshow_item($image) {

$image_properties=getimagesize($image);
switch ($image_properties[2]) {
case
1: $img = imagecreatefromgif($image);break;
case
2: $img = imagecreatefromjpeg($image);break;
case
3: $img = imagecreatefrompng($image);break;
default:
die("<br/><br/>onbekend bestandstype: $image");
}


if ($image_properties[0]>=($GLOBALS["width"]-2*$GLOBALS["image_margin"])) {
$img = scale_image($img, ($GLOBALS["width"]-2*$GLOBALS["image_margin"])/$image_properties[0]);
if ($GLOBALS["image_border"]) { $img = draw_image_border($img); }
if ($GLOBALS["image_dropShadow"]) { $img = draw_dropShadow($img, $GLOBALS["image_dropShadow_scale"], $GLOBALS["image_dropShadow_offset"], $GLOBALS["image_dropShadow_blurRadius"], $GLOBALS["background_color"], $GLOBALS["dropShadow_color"], $GLOBALS["image_offset_x"], $GLOBALS["image_offset_y"]); }
}

else {
if ($GLOBALS["image_border"]) { $img = draw_image_border($img); }
if ($GLOBALS["image_dropShadow"]) { $img = draw_dropShadow($img, $GLOBALS["image_dropShadow_scale"], $GLOBALS["image_dropShadow_offset"], $GLOBALS["image_dropShadow_blurRadius"], $GLOBALS["background_color"], $GLOBALS["dropShadow_color"], $GLOBALS["image_offset_x"], $GLOBALS["image_offset_y"]); }
}


switch ($GLOBALS["slideshow_filetype"]) {
case
"png": {
imagepng($img, "./.modified/".$GLOBALS["width"]."_mod_".$image.".".$GLOBALS["slideshow_filetype"]);
}

break;
case
"jpg": {
imagejpeg($img, "./.modified/".$GLOBALS["width"]."_mod_".$image.".".$GLOBALS["slideshow_filetype"]);
}

break;
default: {

die("<br/><br/>ERROR: Dit bestandstype wordt niet ondersteund voor thumbnails: ".$GLOBALS["slideshow_filetype"]);
}
}


imagedestroy($img);
return TRUE;
}


// ===== De gallerie =================================================================================================
$gallery_name = key($galleries);

// ===== De navigatie ================================================================================================
echo "<div id=\"navigation\">";

if ($multipleGalleries) {
foreach ($galleries as $entry) {
echo "<a href=\"index.php?page=5&gallery=$entry\" title=\"map ".key($galleries)."\">".key($galleries)."</a> | ";
if ($gallery==$entry) { $gallery_name = key($galleries); }
next($galleries);
}
}


echo "</div>";

// ===== De images array aanmaken ====================================================================================
chdir($gallery);
$directory = dir("./");
$images_array = array();
while ($file = $directory->read()) {
if (is_file($file) and in_array(strtolower(substr($file, -4)), array(".png", ".jpg", ".gif"))) {
$images_array[] = $file;
}
}

$directory->close();
reset($images_array);

$images_count = count($images_array);
sort($images_array);

$descriptions = explode('>',file_get_contents('photo_description.txt'));
$descriptions_array = array();
while ($value = next($descriptions)) {
$value = explode('<', $value);
$descriptions_array[$value[0]] = $value[1];
}

// ===== Alles aanmaken voor de gallerie =============================================================================
if ($_GET["action"]=="generate_all") {
$count1=0;
$count2=0;
echo "<p>";
foreach ($images_array as $image) {
if (!is_file("./.thumbs/$thumbnail_size"."_thumb_".$image.".".$thumbnail_filetype)) {
create_thumbnail($image);
echo "thumbnail aangemaakt voor: <i>$image</i><br/>";
$count1++;
}

if (!is_file("./.modified/$width"."_mod_".$image.".".$slideshow_filetype)) {
create_slideshow_item($image);
echo "slideshow afbeelding aangemaakt voor: <i>$image</i><br/>";
$count2++;
}
}

echo "<br/><br/><b>$count1</b> thumbnails en <b>$count2</b> slideshow afbeeldingen voor de gallerij: <i>$gallery_name</i></p>";
}


// ===== De gallerij aanmaken ========================================================================================
switch ($view) {
case
"thumbnails": {

echo "<div id=\"statusbar\">";
echo "<b>$images_count Bergonzoni</b><hr color=#000000 size=1><br>";
if ($thumbnail_indexing) {
$images_array = array_chunk($images_array, $thumbnails_per_page);
$images_array = $images_array[$thumbnail_index];

}

echo "</div>";

echo "<div id=\"img_area\">";
$i = 1;
$row = 0;
foreach ($images_array as $image) {

if (!is_file("./.thumbs/$thumbnail_size"."_thumb_".$image.".".$thumbnail_filetype)) { create_thumbnail($image); }

echo "<a href=\"index.php?page=5&view=slideshow&gallery=$gallery&slideshow_index=".($i-1+$row*$thumbnails_per_row+$thumbnail_index*$thumbnails_per_page)."\"><img src=\"$gallery/.thumbs/$thumbnail_size"."_thumb_".$image.".".$thumbnail_filetype."\" title=\"$image\" alt=\"thumbnail\" style=\"border-style: solid; border-width: 1px; border-color: #000000;\"/>" . $descriptions_array[$image] . "</a>";
if ($i==$thumbnails_per_row) {
$i = 1;
echo "<br/>";
$row++;
}

else { $i++; }
next($images_array);
}
if ($images_count>$thumbnails_per_page) {
echo "<p align=center>";
if ($thumbnail_index>0) { echo "<a href=\"index.php?page=5&view=thumbnails&gallery=$gallery&thumbnail_index=".($thumbnail_index-1)."\" title=\"Vorige\"><< Vorige </a>"; }
echo ($thumbnail_index+1)."/".ceil($images_count/$thumbnails_per_page)." ";
if ($thumbnail_index<(ceil($images_count/$thumbnails_per_page)-1)) { echo "<a href=\"index.php?page=5&view=thumbnails&gallery=$gallery&thumbnail_index=".($thumbnail_index+1)."\" title=\"Volgende\">Volgende >></a>"; }
echo "</p>";
}
}

break;
case
"slideshow": {

echo "<div id=\"img_area\">";

if (!is_file("./.modified/$width"."_mod_".$images_array[$slideshow_index].".".$slideshow_filetype)) { create_slideshow_item($images_array[$slideshow_index]); }

if ($link_original_image) {
echo "<a href=\"$gallery/".$images_array[$slideshow_index]."\"><img src=\"$gallery/.modified/$width"."_mod_".$images_array[$slideshow_index].".".$slideshow_filetype."\" title=\"".$images_array[$slideshow_index]."\" alt=\"".$images_array[$slideshow_index]."\" style=\"border-style: solid; border-width: 1px; border-color: #000000;\"/>" . $descriptions_array[$images_array[$slideshow_index]] . "</a>";
}

else {
echo "<img src=\"$gallery/.modified/$width"."_mod_".$images_array[$slideshow_index].".".$slideshow_filetype."\" title=\"".$images_array[$slideshow_index]."\" alt=\"".$images_array[$slideshow_index]."\" style=\"border-style: solid; border-width: 1px; border-color: #000000;\" width=701/><br>" . $descriptions_array[$images_array[$slideshow_index]];
}

echo "<div id=\"statusbar\"><p align=center>";
if ($slideshow_index>0) { echo "<a href=\"index.php?page=5&view=slideshow&gallery=$gallery&slideshow_index=".($slideshow_index-1)."\" title=\"Vorige\"><< vorige </a>"; }
echo ($slideshow_index+1)."/$images_count ";
if ($slideshow_index<($images_count-1)) { echo "<a href=\"index.php?page=5&view=slideshow&gallery=$gallery&slideshow_index=".($slideshow_index+1)."\" title=\"Volgende\">volgende >></a>"; }
echo "</p></div>";
}

break;
}

echo "</div>";
?>




En dit is het admin gedeelte

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php if (session_is_registered("sess_loginnr") && session_is_registered("sess_id")) { ?>

<b>Controlpanel</b> [Bergonzoni]
<hr color=#FF0000 size="1"><br>
<b>Upload jpg-files</b><hr color=#000000 size="1">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
$config
['map'] = "photoalbum bergonzoni/"; //aanpassen

function upload_size( $size, $maxm="10000000" ) { //maxm wijzigen
if( $size > $maxm ) {
error( 'Je file is te groot!<br><br>' );
}
}

function
error( $error, $exit=TRUE ) {
echo $error;
if( $exit == TRUE ) {
exit;
}
}

function
bestaat_al( $naam ) {
if( file_exists( $naam ) ) {
error( 'Filename allready excised/Make sure all fields are filled in!<br><br>' );
}
}


if( isset($_POST['uploaden']) ) {
if (!isset($_POST['description'])){
error ('Je hebt geen description opgegeven<br><br>');
}
else {
upload_size( $_FILES['upload']['size'] );
bestaat_al( $config['map'] . $_FILES['upload']['name'] );
if (!move_uploaded_file( $_FILES['upload']['tmp_name'], $config['map'] . $_FILES['upload']['name'] )) {
error ('Het uploaden van het plaatje is mislukt<br><br>');
}
else {
if (!$fileHandle = fopen($config['map'] . 'photo_description.txt', 'a')) {
unlink($config['map'] . $_FILES['upload']['name']);
error ('Het commentaar bestand kon niet worden geopend');
}
else {
if (!fwrite($fileHandle, '>' . $_FILES['upload']['name'] . '<' . htmlentities($_POST['description']))) {
unlink($config['map'] . $_FILES['upload']['name']);
error ('Er kon geen commentaar in het bestand worden geschreven');
}
else {
fclose($fileHandle);
echo 'Je plaatje is geupload!<br><br>';
}
}
}
}
}
else {
?>


<table> <form method="post" enctype="multipart/form-data" name="upload">
<tr>
<td>File:</td>
<td><input type="file" name="upload" id="upload"></td>
<td>Omschrijving:</td>
<td><input type="text" name="description"></td>
</tr>
<tr>
<td>Upload:</td>
<td><input type="submit" name="uploaden" value="uploaden"></td>
</tr>
</form></table>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
<?php
} ?>

<br><b>Delete jpg-files</b><hr color=#000000 size="1">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
$the_array
= Array();
$handle = opendir('photoalbum bergonzoni');

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") { /* as descripted below: these "files" will not be added to the array */
$the_array[] = $file;
}
}

closedir($handle);
echo "<form action=\"toevoeg.php?page=admin4\" method=\"post\">";
echo " <select name=\"verwijderen\">";
foreach ($the_array as $element) {
echo "\n <option>$element <br></option> ";
}

echo "\n";
echo "</select> <input type=\"submit\" name=\"action\" value=\"Verwijder\">";

if($_POST['verwijderen']) {
//verwijderen
if($_POST['verwijderen'] !='.thumbs' AND $_POST['verwijderen'] !='.modified' AND $_POST['verwijderen'] != 'photo_description.txt') {
unlink("photoalbum bergonzoni/" . $_POST['verwijderen']);
$descriptions = explode('>',file_get_contents('photo_description.txt'));
$descriptions_array = array();
while ($value = next($descriptions)) {
$value = explode('<', $value);
$descriptions_array[$value[0]] = $value[1];
}

unset($descriptions_array[$_POST['verijderen']]);
echo "<br><br><b>Deleting... </b>";
echo "<META HTTP-EQUIV=\"REFRESH\"CONTENT=\"0.5; URL=index.php?page=admin4\">";
}
else { echo '<br><br>Not allowed.'; }}
?>

</form>
<br><br>
<i>Make your choice: <a href=index.php?page=admin3>[Home]</a> <a href=index.php?page=admin5> [News]</a> <a href=index.php?page=admin4> [Bergonzoni]</a> <a href=index.php?page=admin11>[Dynamic]</a> <a href=index.php?page=admin12>[WRC]</a> <a href=index.php?page=admin13> [Collari]</a> <a href=index.php?page=14> [Supercross]</a> <a href=index.php?page=admin15> [Modellsport]</a> <a href=index.php?admin16> [MDI]</a> <a href=index.php?page=6> [Race Calendar]</a> <a href=index.php?page=admin7>[Links]</a> <a href=index.php?page=admin8>[Distributors</a> <a href=index.php?page=admin9>[Logout]</a></i>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php } else { echo '<b>Controlpanel</b><hr color=#FF0000 size="1"><br>Sorry, no permission.';} ?>



Bij voorbaat dank

Groetjes erika
 
Er zijn nog geen reacties op dit bericht.



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.