But it can't show the image at I-Circle
Here's where I upload to
http://a252.890m.com/image.php
Here's the orginal PHP Code
<?php
/*
* Author : Zeuxis Lo
* Date : 2007/07/19 19:10 PM
* Site : http://skhk.uni.cc/
*/
class SeekReadRndDir {
var $imageDir = 'image';
var $imageMaxW= 500;
var $imageMaxH= 70;
function rDir() {
$imageArr = array();
$f = opendir($this->imageDir);
while($files = readdir($f)) {
if ($files != '..' && $files != '.' && preg_match("/(jpg|gif|png)$/i", $files)) {
$imageArr[] = $files;
}
}
closedir($f);
return $imageArr;
}
function pImage($image) {
list($w, $h,,,) = getimagesize($this->imageDir.'/'.$image);
$tmp_w = $w;
$tmp_h = $h;
if ($tmp_h > $this->imageMaxH) {
$tmp_h = $this->imageMaxH;
$percent = ($h / $tmp_h);
$tmp_w = ($w / $percent);
}elseif ($tmp_w > $this->imageMaxW) {
$tmp_w = $this->imageMaxW;
$percent = ($w / $tmp_w);
$tmp_h = ($h / $percent);
}
return array('w'=>$tmp_w, 'h'=>$tmp_h);
}
function sRnd() {
$dirArr = $this->rDir();
$getRand= rand(0,count($dirArr)-1);
$getSize= $this->pImage($dirArr[$getRand]);
echo "<img src='".$this->imageDir.'/'.$dirArr[$getRand]."' width='".$getSize['w']."' height='".$getSize['h']."' />";
}
}
$o = new SeekReadRndDir;
$o ->sRnd();
?>
Please have a look what's wrong wit that
[ 本文章最後由 a252 於 2008-1-17 15:13 編輯 ]