作者 lyh

gx

... ... @@ -107,17 +107,20 @@ class ImageController extends Controller
}
if($info['is_cos'] == 1){
$filename = getImageUrl($info['path']);
}else{
//查看缩略图是否存在
$filename = $this->config['root'] . $info['path'] . '_' . $w . '_' . $h;
}
if(is_file($filename)){
$content = file_get_contents($filename);
$header['Content-Length'] = strlen($content);
}else{
$content = $this->readImageContent($info,$w,$h);
$header['Content-Length'] = strlen($content);
//查看缩略图是否存在
$filename = $this->config['root'] . $info['path'] . '_' . $w . '_' . $h;
if(is_file($filename)){
$content = file_get_contents($filename);
$header['Content-Length'] = strlen($content);
}else{
$content = $this->readImageContent($info,$w,$h);
$header['Content-Length'] = strlen($content);
}
}
$header['Content-Type'] = $info['mime'];
return response($content,200,$header);
}
... ... @@ -135,7 +138,7 @@ class ImageController extends Controller
$path = $this->cacheImage($info, $w, $h);
$content = file_get_contents($path);
} else {
$content = file_get_contents($info['path']);
$content = file_get_contents($this->config['root'] . $info['path']);
}
return $content;
}
... ...