fotoalbum-tumbnails

Gesponsorde koppelingen

PHP script bestanden

  1. fotoalbum-tumbnails

« Lees de omschrijving en reacties

<html>
<head>
<style type="text/css">
<!--
table { border-collapse: collapse; border: 1px solid #C0C0C0; }
td { border: 1px solid #C0C0C0;}
a:link { color: black }
a:visited { color: black }
a:hover { color: gray }
a:active { color: black }

-->
</style>

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
<?php

$album
= $_GET['album'];
$directory = "./$album";    
$id = $_GET['id'];
echo "<title>Fotoalbum $album</title>\n";
echo "</head>\n";
echo "<body>\n";

if(empty($album)){
    echo "Selecteer een album";
}

elseif(is_dir($directory)){
    if(!isset($id)){        
        $a_jpeg = array();
        if ($dir = @opendir("$directory")) {
          while (($file = readdir($dir)) !== false) {
           $filetype = substr($file,-3,3);
           if ($filetype == "jpg" || $filetype == "JPG" ){
               $a_jpeg[] = $directory."/thumbs/".$file;
         if(!is_dir("$directory/thumbs"))
            {

                $res = @mkdir("$directory/thumbs",0777);
                
                if(!$res)
                {

                    echo "Geen rechten om thumbnails aan te maken.";
                    exit();
                }

                else
                    chmod("$directory/thumbs",0777);
            }

        
            $imagehw = GetImageSize("$directory/$file");
            $src_width = $imagehw[0];  
            $src_height = $imagehw[1];
                    
            $src_width > $src_height ? $dest_width = 75 : $dest_width = 50;
            
            $tmp = $src_width / $dest_width;
            $dest_height = $src_height / $tmp;
                
            $src_img = imagecreatefromjpeg("$directory/$file");
            $dst_img = imagecreatetruecolor($dest_width,$dest_height);
            
            imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width,    $dest_height, $src_width, $src_height);
            imagejpeg($dst_img, "$directory/thumbs/$file", 75);
            imagedestroy($src_img);
            imagedestroy($dst_img);
             
            }
          }

          closedir($dir);
          
        }

            echo "<table border=0 align=center>\n";
            echo "\t<tr>\n\t\t<td colspan=4 align=center><p style=\"text-transform: capitalize; font-size: 24pt\">$album</p></td>\n\t</tr>\n";

                for($i = 0; $i < count($a_jpeg); $i++){
                  echo "\t<tr>\n";
                  if(file_exists($a_jpeg[$i])){
                  echo "\t\t<td align=center><a href=\"?album=" . $album . "&id=" . $i . "\"><img src=\"".$a_jpeg[$i]."\" border=0></td>\n";
                    }

                    else
                    {
                        echo "";
                    }

                  $i++;
                  if(file_exists($a_jpeg[$i])){
                  echo "\t\t<td align=center><a href=\"?album=" . $album . "&id=" . $i . "\"><img src=\"".$a_jpeg[$i]."\" border=0></td>\n";
                    }

                    else
                    {
                        echo "";
                    }

                  $i++;
                  if(file_exists($a_jpeg[$i])){
                  echo "\t\t<td align=center><a href=\"?album=" . $album . "&id=" . $i . "\"><img src=\"".$a_jpeg[$i]."\" border=0></td>\n";
                    }

                    else
                    {
                        echo "";
                    }

                  $i++;
                  if(file_exists($a_jpeg[$i])){
                  echo "\t\t<td align=center><a href=\"?album=" . $album . "&id=" . $i . "\"><img src=\"".$a_jpeg[$i]."\" border=0></td>\n";
                    }

                    else
                    {
                        echo "";
                    }

                  echo "\t</tr>\n";
                }


            echo "\t<tr>\n\t\t<td colspan=4 align=center>Made by Zim</td>\n\t</tr>\n";
            echo "</table>";
        }

    else
    {
        $b_jpeg = array();
        if ($dir = @opendir("$directory")) {
            while (($file = readdir($dir)) !== false) {
                $filetype = substr($file,-3,3);
                if ($filetype == "jpg" || $filetype == "JPG" ){
                    $b_jpeg[] = $directory."/".$file;
                   }

               $max = count($b_jpeg);
               }

            closedir($dir);
        }

           $volgende = $id+1;
           $volgende2 = $id+2;
           $vorige = $id-1;
           $vorige2 = $id;
           echo "<table border=1 align=center>\n";
            echo "\t<tr>\n\t\t<td colspan=2 align=center><p style=\"text-transform: capitalize; font-size: 24pt\">$album</p></td>\n\t</tr>\n";
                echo "\t<tr>\n";
                    echo "\t\t<td width=50% align=right>";
                        if($vorige2 >= 1){
                            echo "<a href=?album=$album&id=$vorige>Vorige</a>";
                        }

                        else
                        {
                            echo "Vorige";
                        }

                        echo "</td>\n";
                        
                        echo "\t\t<td width=50% align=left>";
                        if($volgende2 <= $max){
                            echo "<a href=?album=$album&id=$volgende>Volgende</a>";
                        }

                        else
                        {
                            echo "Volgende";
                        }

                        echo "</td>\n";
          echo "\t</tr>\n";
                echo "\t<tr>\n";
                    echo "\t\t<td colspan=2>";
                          echo "<img src=\"$b_jpeg[$id]\">";
                    echo "</td>\n";
                echo "\t</tr>\n";
                echo "\t<tr>\n";
                    echo "\t\t<td align=center colspan=2>";
                        echo "<a href=?album=$album>Ga terug naar het Album</a>";
                    echo "</td>\n";
                echo "\t</tr>\n";
            echo "</table>";
    }
}

else
{
    echo "De directory die jij zoekt ($album) bestaat niet";
}







?>

 
 

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.