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
| <?php //include('login.php');
define('C_IMG_PATH', './images/');
define('C_THUMBNAIL_PATH', './images/thumbnails/');
define('C_JPEG_QUALITY', 70);
define('C_IMG_PERROW', 5);
function thumb($srcpath, $src) {
if (file_exists($srcpath.$src)) {
$thumbname = C_THUMBNAIL_PATH . '_thumb-'.$src;
if (!file_exists($thumbname)) {
$srcimg = ImageCreateFromJPEG($srcpath.$src);
$newy = 100;
$sx = ImageSX($srcimg); $sy = ImageSY($srcimg);
$newx = $sx * ($newy / $sy);
$destimg = ImageCreateTrueColor($newx, $newy);
ImageCopyResampled($destimg, $srcimg, 0,0,0,0, $newx, $newy, ImageSX($srcimg), ImageSY($srcimg));
ImageDestroy($srcimg);
ImageJPEG($destimg, $thumbname, C_JPEG_QUALITY);
}
return $thumbname;
}
}
function filesizestring($file) {
$size = filesize($file);
if ($size < 1024) return $size.' Bytes';
else if ($size < 10*1024) return ((int)($size*10/1024))/10 . ' KB';
else return (int)($size/1024) . ' KB';
}
function fileinfo($path, $imgname) {
$size = getImageSize($path.$imgname);
return $imgname."\nDimensions: ".$size[0].'x'.$size[1]."\nSize: ".filesizestring($path.$imgname)."\nLast Modified: ".date("M j Y",filemtime($path.$imgname));
}
function imagelink($path, $imgname) {
$size = getImageSize($path.$imgname);
return '[img]"'.thumb($path,[/img]';
}
function imagelist($dir) {
$d = dir($dir);
print('<TABLE align=center BORDER=0 cellspacing=20 cellpadding=5>');
$i = 0;
while($entry = $d->read()) {
if ((strstr($entry, '.jpg') || strstr($entry, '.JPG'))&& !strstr($entry, '_thumb-')) {
if ($i++%C_IMG_PERROW == 0) print("\n<TR>\n");
print('<TD HEIGHT=100 align=center>' . imagelink($d->path, $entry). "</TD>\n");
if ($i%C_IMG_PERROW == 0) print("</TR>\n");
}
}
$d->close();
print('</TABLE>');
}
?>
<html>
<head>
<script language="javaScript">
<!--
function imageover(cur, flag) {
if (flag == 0) cur.filters.alpha.opacity = 40;
else cur.filters.alpha.opacity = 100;
}
function imageclick(target,w,h) {
var scroll = 'no';
if (w > screen.width) {w = screen.width; scroll = 'yes';}
if (h > screen.height) {h = screen.height; scroll = 'yes';}
settings='width='+w+',height='+h+',scrollbars='+scroll+',top=0,left=0,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open('','ImageView',settings);
win.document.write('<html><head><link rel="stylesheet" type="text/css" href="imageview.css"><title>Click to close</title></head><body>[img]"'+target+'"[/img]</body></html>');
}
//-->
</script>
</head>
<body bgcolor=black text=yellow>
<?php imagelist(C_IMG_PATH);?>
</body>
</html> |