处理无图像的图像

This commit is contained in:
wlx 2013-06-02 06:50:41 +00:00
parent 194b8d3a5e
commit 1375ec7643
1 changed files with 13 additions and 5 deletions

View File

@ -89,11 +89,19 @@ class ServiceController extends Zend_Controller_Action
exit;
} else {
$url=$this->config->bigthumb->path.sprintf('%05d',floor(($thumb['gid']+0.1)/100)*100).'-'.sprintf('%05d',ceil(($thumb['gid']+0.1)/100)*100-1)."/".$thumb['gid'];
$url.='/public/'.str_replace('_s.','.',$thumb['filename']);
header("Content-Type:image/".$thumb['filetype']);
$file=fopen($url,'r');
fpassthru($file);
exit;
$url.='/public/'.str_replace('_s.','.',$thumb['filename']);
if (file_exists($url)) {
header("Content-Type:image/".$thumb['filetype']);
$file=fopen($url,'r');
fpassthru($file);
exit;
} else {
header("Content-Type:image/png");
header("Content-Length: " . filesize("images/nothumb.png"));
$file=fopen("images/nothumb.png",'r');
fpassthru($file);
exit;
}
}
}
/*