3 * FileIO Normal 本機儲存 API
\r
5 * 以本機硬碟空間作為圖檔儲存的方式,並提供一套方法供程式管理圖片
\r
7 * @package PMCLibrary
\r
8 * @version $Id: fileio.normal.php 393 2007-04-30 11:25:29Z scribe $
\r
9 * @date $Date: 2007-04-30 19:25:29 +0800 (星期一, 30 四月 2007) $
\r
13 var $path, $imgPath, $thumbPath;
\r
15 /* private 藉由檔名分辨圖檔存放位置 */
\r
16 function _getImagePhysicalPath($imgname){
\r
17 return (substr($imgname, -5)=='s.jpg' ? $this->thumbPath : $this->imgPath).$imgname;
\r
20 function FileIO($parameter='', $ENV){
\r
21 $this->path = $ENV['PATH'];
\r
22 $this->imgPath = $this->path.$ENV['IMG'];
\r
23 $this->thumbPath = $this->path.$ENV['THUMB'];
\r
30 function imageExists($imgname){
\r
31 return file_exists($this->_getImagePhysicalPath($imgname));
\r
34 function deleteImage($imgname){
\r
35 if(is_array($imgname)){ foreach($imgname as $i){ if(!@unlink($this->_getImagePhysicalPath($i))) return false; } return true; }
\r
36 else{ return @unlink($this->_getImagePhysicalPath($imgname)); }
\r
39 function uploadImage($imgname='', $imgpath='', $imgsize=0){
\r
43 function getImageFilesize($imgname){
\r
44 return @filesize($this->_getImagePhysicalPath($imgname));
\r
47 function getImageURL($imgname){
\r
48 return $this->getImageLocalURL($imgname);
\r