Advertisements
Favorite Links


Hide Advertisements

Startseite | Codeschnipsel | Grafikecke | WhoIs Ch. Lange | Other Stuff |

Codeschnipsel

Auf dieser Seite finden Sie diverse PHP Scripte von Ch. Lange.

GalleryScript

01 | <?
02 |  
############################
03 | ##                          ##
04 | ##    GalleryScript v1.0    ##
05 | ## copyright 2009 Ch. Lange ##
06 | ##                          ##
07 |  ############################
08 |  
09 | ### Thumb size
10 |
$twidht 220;  $theight 165;   // set desired thumbsize like 800x600
11 | ### Table
12 |
$rows 3;  $layout "center";  // set desired number of thumbs in a row
13 | ### Folder
14 |
$verz "./gfx/new";            // set folder where you keep grafics
15 |
16 | ### End Config
17 |
$folder opendir($verz); 
18 |
$filetype = array("jpg""jpeg""gif""png""bmp");
19 |
$pics = array();
20 | while (
$file readdir ($folder)) {
21 | if(
in_array(substr(strtolower($file), strrpos($file,".") + 1),$filetype))
22 | {
23 |
array_push($pics,$verz."/".$file);
24 | }
25 | }
26 |
closedir($folder);
27 |
28 | echo 
"<table align=\"$layout\"><tr>";
29 |
30 | for ( 
$x 0$x count $pics ); $x++ )
31 | {
32 | list(
$width$height,) = getimagesize($pics[$x]);
33 | if (
$width $twidht) {
34 |
$w $width/$twidht;
35 |
$h $height/$w;
36 |
$h floor($h);
37 |
$w $twidht;
38 |
39 | if (
$h $theight) {
40 |
$h $h/$theight;
41 |
$w $twidht/$h;
42 |
$w floor($w);
43 |
$h $theight;
44 | }
45 | echo 
"
46 | <td align=\"center\" valign=\"bottom\">
47 | <a href=\"
$pics[$x]\" target=\"_blank\">
48 | <img src=\"
$pics[$x]\" width=\"$w\" height=\"$h\" border=\"0\" /></a><br />
49 | <span style=\"font-size:8pt; font-style:italic; font-variant: small-caps;\">
50 | <b>Resolution:</b> 
$width x $height </span><p />
51 | </td>"
;
52 |
53 | if((
$x 1) % $rows == 0){
54 | echo 
"</tr><tr>";
55 | }
56 | }
57 | elseif (
$height $theight) {
58 |
$h $height/$theight;
59 |
$w $width/$h;
60 |
$w floor($w);
61 | echo 
"
62 | <td align=\"center\" valign=\"bottom\">
63 | <a href=\"
$pics[$x]\" target=\"_blank\">
64 | <img src=\"
$pics[$x]\" width=\"$w\" height=\"$theight\" border=\"0\" /></a><br />
65 | <span style=\"font-size:8pt; font-style:italic; font-variant: small-caps;\">
66 | <b>Resolution:</b> 
$width x $height </span><p />
67 | </td>"
;
68 |
69 | if((
$x 1) % $rows == 0){
70 | echo 
"</tr><tr>";
71 | }
72 | }
73 | else {
74 | echo 
"
75 | <td align=\"center\" valign=\"bottom\">
76 | <img src=\"
$pics[$x]\" /><br />
77 | <span style=\"font-size:8pt; font-style:italic; font-variant: small-caps;\">
78 | <b>Resolution:</b> 
$width x $height </span><p />
79 | </td>"
;
80 |
81 | if((
$x 1) % $rows == 0){
82 | echo 
"</tr><tr>";
83 | }
84 | }
85 | }
86 | echo 
"</tr></table>";
87 |
88 |
?>

© 2009 Ch. Lange
Impressum / Imprint