麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
一个简单的ftp图片管理程序
悬赏分:20 - 2007年08月17日

演示: http://www.133.za.net/myimage/yisu/index.php 把文件命名为index.php ,直接ftp上传图片到该文件所在目录。 [PHP] <?php $configOpenGzip = true; //是否压缩页面 压缩:true 不压缩:false $configExt = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); //图片类型 $strLenMax = 25; //文件名字限制长度 (防止撑破表格) $configEachPageMax = 12; //每页显示的图片数目 $configEachLineMax = 6; //每行显示的图片数目 $configTDWidth = 140; //表格宽度 $configTDHeight = 175; //表格高度 $configPageMax = 4; //分页前后预览数 $configTilte = "中国数理资源网"; //Title名称 /* +----------------------------------+ | class +----------------------------------+ */ Class neatpic { var $configOpenGzip; var $configExt = array(); var $strLenMax; var $configEachPageMax; var $configEachLineMax; var $configTDHeight; var $configTDWidth; var $configPageMax; var $configTilte; var $pathLevelNum; var $nowDirNmae; var $dirNum; var $picNum; var $pageTotal; var $start; var $offSet; var $pageStart; var $pageMiddle; var $pageEnd; var $temp; var $picID; var $picRealSizeWidth; var $picRealSizeHeight; var $picArray = array(); var $picFileArray = array(); var $dirArray = array(); var $dirNameArray = array(); var $pathArray = array(); var $pathError = false; var $page; var $path; var $style; /* +----------------------------------+ | 赋值函数 */ function neatpic($configOpenGzip, $configExt, $strLenMax, $configEachPageMax, $configEachLineMax, $configTDHeight, $configTDWidth, $configPageMax, $configTilte) { $this->configOpenGzip = $configOpenGzip; $this->configExt = $configExt; $this->strLenMax = $strLenMax; $this->configEachPageMax = $configEachPageMax; $this->configEachLineMax = $configEachLineMax; $this->configTDHeight = $configTDHeight ; $this->configTDWidth = $configTDWidth; $this->configPageMax = $configPageMax; $this->configTilte = $configTilte; } /* +----------------------------------+ | Open gzip */ function gzip() { if ($this->openGzip == true) ob_start("ob_gzhandler"); } /* +----------------------------------+ | Get the querystring */ function getVars() { $this->page = urldecode($_GET['page']); $this->path = $_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; } } /* +----------------------------------+ | GetFileExt +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function getFileExt($fileName) { $pos = strrpos($fileName, '.'); return strtolower(substr($fileName, $pos+1, (strlen($fileName)-$pos-1))); } /* +----------------------------------+ | Make direct list +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function makeDirList() { $dir = dir($this->path); while($file = $dir->read()) { if ($file <> "." and $file <> "..") { $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->picArray[] = $file; $this->picFileArray[] = $fileName; } } } } /* +----------------------------------+ | Get each array number +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function getEachArrayNum() { $this->dirNum = count($this->dirArray); $this->picNum = count($this->picArray); } /* +----------------------------------+ | Make page bar +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function makePageBar() { $this->pageTotal = ceil($this->picNum / $this->configEachPageMax); if (!$this->page or $this->page < 0) $this->page = 1; if ($this->page > $this->pageTotal) $this->page = $this->pageTotal; $this->offSet = $this->configEachPageMax * $this->page; $this->start = $this->offSet - $this->configEachPageMax; if ($this->start < 0) $this->start = 0; if ($this->offSet > $this->picNum) $this->offSet = $this->picNum; $this->pageStart = $this->page - $this->configPageMax; if ($this->pageStart <= 0) $this->pageStart = 1; $this->pageMiddle = $this->page + 1; $this->pageEnd = $this->pageMiddle + $this->configPageMax; if ($this->page <= $this->configPageMax) $this->pageEnd = $this->configPageMax * 2 + 1; if ($this->pageEnd > $this->pageTotal) $this->pageEnd = $this->pageTotal + 1; } /* +----------------------------------+ | Show page bar +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function showPageBar() { print("path."&style=".$this->style."&page=1\" title=\"Top page\">[首 页]\n"); print("[ path."&style=".$this->style."&page=".($this->page - 1)."\" title=\"上一页\">上一页 ] "); for ($i = $this->pageStart; $i < $this->page; $i++) { print("path."&style=".$this->style."&page=".$i."\" title=\"the ".$i." page\">[".$i."] "); } printf("[%s]", $this->page); for ($i = $this->pageMiddle; $i < $this->pageEnd; $i++) { print("path."&style=".$this->style."&page=".$i."\" title=\"the ".$i." page\">[".$i."] "); } printf("...path."&style=".$this->style."&page=".$this->pageTotal."\" title=\"the %s page\">[%s]\n", $this->pageTotal, $this->pageTotal); print("[ path."&style=".$this->style."&page=".($this->page + 1)."\" title=\"Next Thread\">下一页 ] "); printf(" path."&style=".$this->style."&page=".$this->pageTotal."\" title=\"End page\">[尾 页]\n", $this->pageTotal); } /* +----------------------------------+ | Set picture ID +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function setPicID($id) { $this->picID = $id; } /* +----------------------------------+ | Get picture dimension +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function getPicDim() { $picSize = GetImageSize($this->picArray[$this->picID]); preg_match("!width=\"(.*)\" height=\"(.*)\"!", $picSize['3'], $tempSize); $this->picRealSizeWidth = $tempSize['1']; $this->picRealSizeHeight = $tempSize['2']; $tempSize['1'] < $this->configTDWidth ? $this->temp['Width'] = $tempSize['1'] : $this->temp['Width'] = $this->configTDWidth; $tempSize['2'] < $this->configTDHeight ? $this->temp['Height'] = $tempSize['2'] : $this->temp['Height'] = $this->configTDHeight; } /* +----------------------------------+ | Show css +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function showCSS() { print(" "); } /* +----------------------------------+ | Show title +----------------------------------+ | C / M : 2003-12-28 / -- +----------------------------------+ */ function showTitle() { print("\n"); print("".$this->configTilte."\n"); print("\n"); print(" <script> var clicki; clicki = 0; function jump() { clicki = clicki + 1; if (clicki == 10) { this.location = '".$_SERVER['PHP_SELF']."'+'?action=thanks'; } } document.onclick = jump; </script> "); print("\n"); print("
\n"); print("
\n"); } /* +----------------------------------+ | Cute the long file name +----------------------------------+ | C / M : 2003-12-29 / -- +----------------------------------+ */ function sortName($filename) { $strlen = strlen($filename); if ($strlen > $this->strLenMax) $filename = "...".substr($filename, -($this->strLenMax), $strlen); return ; } /* +----------------------------------+ | Show picture list +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function showPicList() { /* +----------------------------------+ | Real size style +----------------------------------+ */ if ($this->style == "real") { for($i = $this->start; $i < $this->offSet; $i++) { $this->setPicID($i); $this->getPicDim(); printf("


\n", $this->picArray[$i], $this->picArray[$i]); } } /* +----------------------------------+ | Small size style +----------------------------------+ */ else { printf("\n"); for($i = $this->start; $i < $this->offSet; $i++) { $I++; $this->setPicID($i); $this->getPicDim(); printf("\n", $this->sortName($this->picFileArray[$i]), $this->configTDWidth, $this->configTDHeight, $this->picArray[$i], $this->picArray[$i], $this->temp['Width'], $this->temp['Height'], $this->picFileArray[$i], $this->picRealSizeWidth, $this->picRealSizeHeight, $picFileSize, $this->picRealSizeWidth, $this->picRealSizeHeight, $picFileSize); if ($this->configEachLineMax == $I) { $I = 0; print("\n"); } } print("\n
%s
\"file%s  
  size : %s * %s pixs  
    \">
\n"); } } /* +----------------------------------+ | Decode +----------------------------------+ | C / M : 2003-12-30 / -- +----------------------------------+ */ function decode($str) { $str = urldecode($str); $str = base64_decode($str); return $str; } /* +----------------------------------+ | Execute Class +----------------------------------+ | C / M : 2003-12-28 / 2003-12-29 +----------------------------------+ */ function execute() { $this->gzip(); $this->getVars(); $this->checkError(); $this->showCSS(); $this->showTitle(); $this->makeDirList(); $this->getEachArrayNum(); $this->makePageBar(); $this->showPageBar(); $this->showPicList(); } } /* +----------------------------------+ | Create object +----------------------------------+ | C / M : 2003-12-29 / -- +----------------------------------+ */ $neatpic = new neatpic($configOpenGzip,$configExt, $strLenMax, $configEachPageMax, $configEachLineMax, $configTDHeight, $configTDWidth, $configPageMax, $configTilte); /* +----------------------------------+ | Execute class +----------------------------------+ | C / M : 2003-12-30 / -- +----------------------------------+ */ $neatpic->execute(); ?> [/PHP]

提问者:jimsoft   08-17 17:05
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
52 + 41 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM