复制代码 代码如下:
$thumb = $_GET['thumb'];
if (!$thumb) {
exit;
}
//
$thumb_array = explode('.',$thumb);
$image = '../';
foreach($thumb_array as $k=>$thumb_part){
if ($k != count($thumb_array)-2) {
$image .= $thumb_part . '.';
}
}
$image = substr($image,0,-1);
list($width,$height) = explode('x',$thumb_array[count($thumb_array)-2]);
//
if (file_exists($image)) {
require('../phpthumb/phpthumb.class.php');
$phpThumb = new phpThumb();
$phpThumb->setSourceFilename($image);
$phpThumb->setParameter('w',$width);
$phpThumb->setParameter('h',$height);
//$phpThumb->setParameter('far','C'); // scale outside
//$phpThumb->setParameter('bg','<SPAN class=caps>FFFFFF</SPAN>'); // scale outside
if ($phpThumb->GenerateThumbnail()) {
mkdir(dirname($thumb),0777,true);
if ($phpThumb->RenderToFile($thumb)) {
header('Location: /thumbs/'.$thumb);
exit;
}
}
}
新闻热点
疑难解答