因为要在LINUX上面呈现
<?php
require("../config.php"); /* Constructor 构造函数 */
function neatpic($configExt, $picnum, $picHeight, $picwidth, $picchangetime, $configTilte) {
$this-> configExt = & $configExt;
$this-> picnum = & $picnum;
$this-> picHeight = & $picHeight ;
$this-> picwidth = & $picwidth;
$this-> picchangetime = & $picchangetime;
$this-> configTilte = & $configTilte;
} /* Get the querystring 查询字串 */
function getVars() {
$this-> page = rawurldecode($_GET['page']);
$this-> path = rawurldecode($_GET['path']);
$this-> style = $_GET['style'];
if (!$this-> style) $this-> style = "small";
if (!$this-> path) $this-> path = ".";
} /* Check error 错误 */
function checkError() {
if (preg_match("/\.\./", $this-> path)) $pathError = true;
if (!is_dir($this-> path)) $pathError = true;
if ($pathError == true) {
header("location:".$_SERVER['PHP_SELF']);
exit;
}
} /* Path array initialize 路径初始化 */
function pathArrayInitialize() {
if (!$this-> path) $this-> path = ".";
$this-> pathArray = explode("/", $this-> path);
$this-> pathLevelNum = count($this-> pathArray);
$this-> nowDirName = $this-> pathArray[$this-> pathLevelNum - 1];
if ($this-> nowDirName == ".") $this-> nowDirName = "相册首页";
} /* Make over direct 结束指令 */
function makeOverdirect() {
$overPath = ".";
for($i = 1; $i < $this-> pathLevelNum - 1; $i++) {
$overPath = $overPath."/".$this-> pathArray[$i];
}
$this-> dirArray[] = $overPath;
$this-> dirNameArray[] = "上一页";
for($i = 1; $i < $this-> pathLevelNum; $i++) {
$this-> encodePath .= rawurlencode($this-> pathArray[$i])."/";
}
} /* GetFileExt */
function getFileExt($fileName) {
$pos = strrpos($fileName, '.');
return strtolower(substr($fileName, $pos+1, (strlen($fileName)-$pos-1)));
} /* 得到目录列表 */
function makeDirList() {
$dir = dir($this-> path);
while($file = $dir-> read()) {
if ($file <> "." and $file <> ".." and $file != "highslide") {
$fileName = $file;
$file = $this-> path."/".$file;
if (is_dir($file)) {
$this-> dirArray[] = $file;
$this-> dirNameArray[] = $fileName;
}
if (in_array($this-> getFileExt($file), $this-> configExt)) {
$this-> picEncodeArray[] = "".$this-> encodePath.rawurlencode($fileName);
$this-> picArray[] = $file;
$this-> picFileArray[] = $fileName;
}
}
}
} /* 得到每组图片数 */
function getEachArrayNum() {
$this-> dirNum = count($this-> dirArray);
$this-> picNum = count($this-> picArray);
} /* 分页设置 */
function makePageBar() {
$this-> pageTotal = ceil($this-> picNum / $this-> picnum);
if (!$this-> page or $this-> page < 0) $this-> page = 1;
if ($this-> page > $this-> pageTotal) $this-> page = $this-> pageTotal;
$this-> offSet = $this-> picnum * $this-> page;
$this-> start = $this-> offSet - $this-> picnum;
if ($this-> start < 0) $this-> start = 0;
if ($this-> offSet > $this-> picNum) $this-> offSet = $this-> picNum;
$this-> pageStart = $this-> page - $this-> picchangetime;
if ($this-> pageStart <= 0) $this-> pageStart = 1;
$this-> pageMiddle = $this-> page + 1;
$this-> pageEnd = $this-> pageMiddle + $this-> picchangetime;
if ($this-> page <= $this-> picchangetime) $this-> pageEnd = $this-> picchangetime * 2 + 1;
if ($this-> pageEnd > $this-> pageTotal) $this-> pageEnd = $this-> pageTotal + 1;
} /* 设置图片ID */
function setPicID($id) {
$this-> picID = $id;
} /* 得到图片尺寸 */
function getPicDim(){
$picSize = GetImageSize($this-> picArray[$this-> picID]);
preg_match("!width=\"(.*)\" height=\"(.*)\"!", $picSize['3'], $tempSize);
$this-> picRealSizeWidth = $tempSize['1'];
$this-> picRealSizeHeight = $tempSize['2'];
$tWidth = $this-> picRealSizeWidth / $this-> picwidth;
$tHeight = $this-> picRealSizeHeight / $this-> picHeight;
if ($this-> picRealSizeWidth > $this-> picwidth OR $this-> picRealSizeHeight > $this-> picHeight) {
if ($tWidth > $tHeight) {
$this-> temp['Width'] = $this-> picwidth;
$this-> temp['Height'] = number_format($this-> picRealSizeHeight / $tWidth);
}
elseif ($tWidth < $tHeight) {
$this-> temp['Height'] = $this-> picHeight;
$this-> temp['Width'] = number_format($this-> picRealSizeWidth / $tHeight);
}
else {
$this-> temp['Width'] = $this-> picwidth;
$this-> temp['Height'] = $this-> picHeight;
}
}
else {
$this-> temp['Width'] = $this-> picRealSizeWidth;
$this-> temp['Height'] = $this-> picRealSizeHeight;
}
} /* 得到相册列表 */
function makeOptionList() {
for($i = 0; $i < $this-> dirNum; $i++)
$this-> dirOptionList .= " [ <a href=\"". $_SERVER['PHP_SELF']."?path=".rawurlencode($this-> dirArray[$i])."\" title=\"相册: ".$this-> dirNameArray[$i]."\"> ".$this-> dirNameArray[$i]." </a> ] \n";
} /* 显示图片列表 */
function showPicList() {
print(' <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> '.$this-> configTilte.' 播放幻灯片 相册:'.$this-> nowDirName.' </title>
<script language="VBscript">
dim FileList,FileListArr
FileList = "');
$session = & $_SESSION;
for($i = $this-> start; $i < $this-> offSet; $i++) {
$I++;
$this-> setPicID($i);
$this-> getPicDim(); print("".$this-> picEncodeArray[$i].",");
}
print('"
dim PlayImg_M
PlayImg_M = '.$this-> picchangetime.' * 1000
</script>
<script language="VBscript" src="../highslide/pic.js"> </script>
</head>
<body bgcolor="#000000">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr id="Noscript">
<td align="center" style="color:white"> 对不起,您的浏览器已设置了禁止脚本运行。 </td>
</tr>
<tr style="display:none" id="CanRunscript">
<td height="" style="" align="Center" valign="center">
<img id="Img" border="0">
</td>
</tr>
<tr style="display:none">
<td> <img id="TempImg" border="0"> </td>
</tr>
</table>
<script language="VBscript">
Noscript.style.display = "none"
CanRunscript.style.display = ""
Img.Src = FileListArr(0)
SetTimeout "ChangeImg", PlayImg_M
</script>
</body>
</html> ');
} /* 错误提示 */
function error($msg) {
echo " <script language=javascript> ";
echo "window.alert('$msg');";
echo "history.go(-1);";
echo " </script> ";
exit;
} /* 输出到主页 */
function execute() {
$this-> getVars();
$this-> checkError();
$this-> pathArrayInitialize();
$this-> makeOverdirect();
$this-> makeDirList();
$this-> getEachArrayNum();
$this-> makeOptionList();
$this-> makepagebar();
$this-> showPicList();
$this-> c();
}
} /* 页面 */
error_reporting(0);
session_start();
header("content-Type: text/html; charset=GB2312");
$neatpic = new neatpic($configExt, $picnum, $picHeight, $picwidth, $picchangetime, $configTilte);
$neatpic-> execute();
?>
<?php
require("../config.php"); /* Constructor 构造函数 */
function neatpic($configExt, $picnum, $picHeight, $picwidth, $picchangetime, $configTilte) {
$this-> configExt = & $configExt;
$this-> picnum = & $picnum;
$this-> picHeight = & $picHeight ;
$this-> picwidth = & $picwidth;
$this-> picchangetime = & $picchangetime;
$this-> configTilte = & $configTilte;
} /* Get the querystring 查询字串 */
function getVars() {
$this-> page = rawurldecode($_GET['page']);
$this-> path = rawurldecode($_GET['path']);
$this-> style = $_GET['style'];
if (!$this-> style) $this-> style = "small";
if (!$this-> path) $this-> path = ".";
} /* Check error 错误 */
function checkError() {
if (preg_match("/\.\./", $this-> path)) $pathError = true;
if (!is_dir($this-> path)) $pathError = true;
if ($pathError == true) {
header("location:".$_SERVER['PHP_SELF']);
exit;
}
} /* Path array initialize 路径初始化 */
function pathArrayInitialize() {
if (!$this-> path) $this-> path = ".";
$this-> pathArray = explode("/", $this-> path);
$this-> pathLevelNum = count($this-> pathArray);
$this-> nowDirName = $this-> pathArray[$this-> pathLevelNum - 1];
if ($this-> nowDirName == ".") $this-> nowDirName = "相册首页";
} /* Make over direct 结束指令 */
function makeOverdirect() {
$overPath = ".";
for($i = 1; $i < $this-> pathLevelNum - 1; $i++) {
$overPath = $overPath."/".$this-> pathArray[$i];
}
$this-> dirArray[] = $overPath;
$this-> dirNameArray[] = "上一页";
for($i = 1; $i < $this-> pathLevelNum; $i++) {
$this-> encodePath .= rawurlencode($this-> pathArray[$i])."/";
}
} /* GetFileExt */
function getFileExt($fileName) {
$pos = strrpos($fileName, '.');
return strtolower(substr($fileName, $pos+1, (strlen($fileName)-$pos-1)));
} /* 得到目录列表 */
function makeDirList() {
$dir = dir($this-> path);
while($file = $dir-> read()) {
if ($file <> "." and $file <> ".." and $file != "highslide") {
$fileName = $file;
$file = $this-> path."/".$file;
if (is_dir($file)) {
$this-> dirArray[] = $file;
$this-> dirNameArray[] = $fileName;
}
if (in_array($this-> getFileExt($file), $this-> configExt)) {
$this-> picEncodeArray[] = "".$this-> encodePath.rawurlencode($fileName);
$this-> picArray[] = $file;
$this-> picFileArray[] = $fileName;
}
}
}
} /* 得到每组图片数 */
function getEachArrayNum() {
$this-> dirNum = count($this-> dirArray);
$this-> picNum = count($this-> picArray);
} /* 分页设置 */
function makePageBar() {
$this-> pageTotal = ceil($this-> picNum / $this-> picnum);
if (!$this-> page or $this-> page < 0) $this-> page = 1;
if ($this-> page > $this-> pageTotal) $this-> page = $this-> pageTotal;
$this-> offSet = $this-> picnum * $this-> page;
$this-> start = $this-> offSet - $this-> picnum;
if ($this-> start < 0) $this-> start = 0;
if ($this-> offSet > $this-> picNum) $this-> offSet = $this-> picNum;
$this-> pageStart = $this-> page - $this-> picchangetime;
if ($this-> pageStart <= 0) $this-> pageStart = 1;
$this-> pageMiddle = $this-> page + 1;
$this-> pageEnd = $this-> pageMiddle + $this-> picchangetime;
if ($this-> page <= $this-> picchangetime) $this-> pageEnd = $this-> picchangetime * 2 + 1;
if ($this-> pageEnd > $this-> pageTotal) $this-> pageEnd = $this-> pageTotal + 1;
} /* 设置图片ID */
function setPicID($id) {
$this-> picID = $id;
} /* 得到图片尺寸 */
function getPicDim(){
$picSize = GetImageSize($this-> picArray[$this-> picID]);
preg_match("!width=\"(.*)\" height=\"(.*)\"!", $picSize['3'], $tempSize);
$this-> picRealSizeWidth = $tempSize['1'];
$this-> picRealSizeHeight = $tempSize['2'];
$tWidth = $this-> picRealSizeWidth / $this-> picwidth;
$tHeight = $this-> picRealSizeHeight / $this-> picHeight;
if ($this-> picRealSizeWidth > $this-> picwidth OR $this-> picRealSizeHeight > $this-> picHeight) {
if ($tWidth > $tHeight) {
$this-> temp['Width'] = $this-> picwidth;
$this-> temp['Height'] = number_format($this-> picRealSizeHeight / $tWidth);
}
elseif ($tWidth < $tHeight) {
$this-> temp['Height'] = $this-> picHeight;
$this-> temp['Width'] = number_format($this-> picRealSizeWidth / $tHeight);
}
else {
$this-> temp['Width'] = $this-> picwidth;
$this-> temp['Height'] = $this-> picHeight;
}
}
else {
$this-> temp['Width'] = $this-> picRealSizeWidth;
$this-> temp['Height'] = $this-> picRealSizeHeight;
}
} /* 得到相册列表 */
function makeOptionList() {
for($i = 0; $i < $this-> dirNum; $i++)
$this-> dirOptionList .= " [ <a href=\"". $_SERVER['PHP_SELF']."?path=".rawurlencode($this-> dirArray[$i])."\" title=\"相册: ".$this-> dirNameArray[$i]."\"> ".$this-> dirNameArray[$i]." </a> ] \n";
} /* 显示图片列表 */
function showPicList() {
print(' <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> '.$this-> configTilte.' 播放幻灯片 相册:'.$this-> nowDirName.' </title>
<script language="VBscript">
dim FileList,FileListArr
FileList = "');
$session = & $_SESSION;
for($i = $this-> start; $i < $this-> offSet; $i++) {
$I++;
$this-> setPicID($i);
$this-> getPicDim(); print("".$this-> picEncodeArray[$i].",");
}
print('"
dim PlayImg_M
PlayImg_M = '.$this-> picchangetime.' * 1000
</script>
<script language="VBscript" src="../highslide/pic.js"> </script>
</head>
<body bgcolor="#000000">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr id="Noscript">
<td align="center" style="color:white"> 对不起,您的浏览器已设置了禁止脚本运行。 </td>
</tr>
<tr style="display:none" id="CanRunscript">
<td height="" style="" align="Center" valign="center">
<img id="Img" border="0">
</td>
</tr>
<tr style="display:none">
<td> <img id="TempImg" border="0"> </td>
</tr>
</table>
<script language="VBscript">
Noscript.style.display = "none"
CanRunscript.style.display = ""
Img.Src = FileListArr(0)
SetTimeout "ChangeImg", PlayImg_M
</script>
</body>
</html> ');
} /* 错误提示 */
function error($msg) {
echo " <script language=javascript> ";
echo "window.alert('$msg');";
echo "history.go(-1);";
echo " </script> ";
exit;
} /* 输出到主页 */
function execute() {
$this-> getVars();
$this-> checkError();
$this-> pathArrayInitialize();
$this-> makeOverdirect();
$this-> makeDirList();
$this-> getEachArrayNum();
$this-> makeOptionList();
$this-> makepagebar();
$this-> showPicList();
$this-> c();
}
} /* 页面 */
error_reporting(0);
session_start();
header("content-Type: text/html; charset=GB2312");
$neatpic = new neatpic($configExt, $picnum, $picHeight, $picwidth, $picchangetime, $configTilte);
$neatpic-> execute();
?>
Noscript.style.display = "none"
CanRunscript.style.display = ""
Img.Src = FileListArr(0)
SetTimeout "ChangeImg", PlayImg_M
</script> 改为:
<script language="JSscript">
document.getElementById("Noscript").style.display = "none"
document.getElementById("CanRunscript").style.display = ""
Img.Src = FileListArr(0)
SetTimeout("ChangeImg", PlayImg_M )</script>
* 显示图片列表 */
function showPicList() {
print(' <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> '.$this-> configTilte.' 播放幻灯片 相册:'.$this-> nowDirName.' </title>
<script language="VBscript">
dim FileList,FileListArr
FileList = "');
$session = & $_SESSION;
for($i = $this-> start; $i < $this-> offSet; $i++) {
$I++;
$this-> setPicID($i);
$this-> getPicDim(); print("".$this-> picEncodeArray[$i].",");
}
print('"
dim PlayImg_M
PlayImg_M = '.$this-> picchangetime.' * 1000
</script>
<script language="VBscript" src="../highslide/pic.js"> </script>
</head>
<body bgcolor="#000000">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr id="Noscript">
<td align="center" style="color:white"> 对不起,您的浏览器已设置了禁止脚本运行。 </td>
</tr>
<tr style="display:none" id="CanRunscript">
<td height="" style="" align="Center" valign="center">
<img id="Img" border="0">
</td>
</tr>
<tr style="display:none">
<td> <img id="TempImg" border="0"> </td>
</tr>
</table>
<script language="VBscript">
Noscript.style.display = "none"
CanRunscript.style.display = ""
Img.Src = FileListArr(0)
SetTimeout "ChangeImg", PlayImg_M
</script>
</body>
</html> ');
} /* 错误提示 */
function error($msg) {
echo " <script language=javascript> ";
echo "window.alert('$msg');";
echo "history.go(-1);";
echo " </script> ";
exit;
}
这些是函数啊
JS和VBS里都可以使用这样的函数的啊!
<script language="VBscript">
dim FileList,FileListArr
FileList = "');
$session = & $_SESSION;
for($i = $this->start; $i < $this->offSet; $i++) {
$I++;
$this->setPicID($i);
$this->getPicDim(); print("".$this->picEncodeArray[$i].",");
}
print('"
dim PlayImg_M
PlayImg_M = '.$this->picchangetime.' * 1000
</script>
你这里,把VBscript改成javascript,dim改成var就差不多了吧