easyPic Skript

Hier ein kleines PHP-Skript, mit dem Bilder einfach angezeigt werden können.

Beispiele unter: http://www.todesleitzentrale.de/

pic.inc
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
<? 

// ################################
// ###      CONFIGURATION       ###
// ################################


$thumbQueryString='?con=12';
$thumbPrefix 'm_';
$thumbDir 'pics09/thumbs';
$thumbMaxCell 2;
$thumbFilesPerPage=20;                //    0 = all
$thumbShowPictureNumberLinks true;
$thumbShowPictureNextLink true;
$thumbShowPicturePrevLink true;

$imageQueryString='window.php?d=1';
$imagePrefix 'l_';
$imageDir 'images';
$imageShowPictureNumberLinks false;
$imageShowPictureNextLink true;
$imageShowPicturePrevLink true;
$imageShowPictureNr true;
$imageShowPictureCount true;
$windowLink='pics09/window.php';

// ################################
// ###     END CONFIGURATION    ###
// ################################

// set up Script vars
$pic=1;
if(isset(
$_REQUEST['pic']))
    
$pic $_REQUEST['pic'];

if(isset(
$_REQUEST['showImage'])) {
    
    
$showImage=true;
    
$queryString $imageQueryString.'&amp;showImage=1';
    
$dirName=$imageDir;
    
$filesPerPage=1;

} else {
    
    
$showImage=false;
    
$queryString $thumbQueryString;
    
$dirName=$thumbDir;
    
$filesPerPage $thumbFilesPerPage;
    
    
$maxCell $thumbMaxCell;
}

//read in dir
$dir opendir($dirName);
if(!
$dir) die();
while(
false !== ($file readdir($dir)))
    if(!
is_dir($dirName.'/'.$file))
        
$files[] = $file;

//sort it by name
sort($files);    

$maxFiles count($files);

// calculate Pages and prev/next links
if($filesPerPage>0) {
        
    
//cut file array
    
for($n=1;$n<$pic;$n++)
        
array_shift($files);
    while(
count($files)>$filesPerPage)
        
array_pop($files);
    
    
//next link
    
if($pic+$filesPerPage>=$maxFiles)                $next=1;
    else                            
$next=$pic+$filesPerPage;
    
//prev link
    
if($pic==1)                        $prev=$maxFiles-($maxFiles $filesPerPage)+($filesPerPage==1?0:1);
    elseif(
$pic-$filesPerPage<1)    $prev ;
    else                             
$prev=$pic-$filesPerPage;
}

    if(
$filesPerPage>0) { 
        
        if((
$showImage && $imageShowPictureNumberLinks) || (!$showImage && $thumbShowPictureNumberLinks)) { ?>
            
            <?    for($pics=1;$pics<=$maxFiles;$pics+=$filesPerPage) { 
                 if(
$pics==$pic) {?><span><?=(int)($pics/$filesPerPage)?></span> <?}else{?><a href="<?=$queryString?>&amp;pic=<?=$pics?>"><?=(int)($pics/$filesPerPage)?></a> <? }
            }
        } 
?>
        <br>
<?        if(($showImage && $imageShowPicturePrevLink) || (!$showImage && $thumbShowPicturePrevLink)) { ?>
            <a href="<?=$queryString?>&amp;pic=<?=$prev?>">Vorherige Seite</a>
<?        
        
        if((
$showImage && $imageShowPictureNextLink) || (!$showImage && $thumbShowPictureNextLink)) { ?>
            <a href="<?=$queryString?>&amp;pic=<?=$next?>">Nächste Seite</a>
<?        
    } 
    
    if(
$showImage) { 
        
$file reset($files);
        
        if(
$imageShowPictureNr) {?><?=$pic?><? } if($imageShowPictureCount) {?>/<?=$maxFiles?><? ?><br>
        <img src="<?=$imageDir?>/<?=$file?>" alt="<?=$file?>">

<? } else { ?>

        <table>
            <tr>
<?        $i=1$line=1;
        foreach(
$files as $file) { 
            if(
$i++>$maxCell) { $i=2$line++;?>
            </tr>
            <tr>
<?            ?>
                <td><a onClick="window.open('','picture','toolbar=0,location=0,directories=0,status=yes,menubar=0,scrollbars=yes,resizable=yes,width=525,height=550,titlebar=yes')" target="picture" href="<?=$windowLink?><?=$queryString?>&amp;showImage=1&amp;pic=<?=$pic?>"><img src="<?=$thumbDir?>/<?=$file?>" alt="<?=$file?>"></a></td>
<?        $pic++; }
        
        for(
$j=$i;$j<=$maxCell;$j++) { ?>
                 <td>&nbsp;</td>
<?        }
        
closedir($dir); ?>
            </tr>
        </table>

<?    ?>    
win.inc
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Bilder</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
        a:link,a:visited{color:#d4caca;font-weight:bold;text-decoration:none}
        a:hover{color:#6b3939}
        BODY, table {    
            font-family:Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            color: #FFFFFF;
            margin:0px; padding: 0px;
        }
        BODY { background-color: #000000;
             }
        *.menu {color: #FFFFFF;font-size: 14px;font-family:Verdana, Arial, Helvetica, sans-serif; }
    </style>
  </head>

  <body>
    
<?    include('pic.inc'); ?>

</body>
</html>