正在显示
1 个修改的文件
包含
11 行增加
和
8 行删除
| @@ -107,17 +107,20 @@ class ImageController extends Controller | @@ -107,17 +107,20 @@ class ImageController extends Controller | ||
| 107 | } | 107 | } |
| 108 | if($info['is_cos'] == 1){ | 108 | if($info['is_cos'] == 1){ |
| 109 | $filename = getImageUrl($info['path']); | 109 | $filename = getImageUrl($info['path']); |
| 110 | - }else{ | ||
| 111 | - //查看缩略图是否存在 | ||
| 112 | - $filename = $this->config['root'] . $info['path'] . '_' . $w . '_' . $h; | ||
| 113 | - } | ||
| 114 | - if(is_file($filename)){ | ||
| 115 | $content = file_get_contents($filename); | 110 | $content = file_get_contents($filename); |
| 116 | $header['Content-Length'] = strlen($content); | 111 | $header['Content-Length'] = strlen($content); |
| 117 | }else{ | 112 | }else{ |
| 118 | - $content = $this->readImageContent($info,$w,$h); | ||
| 119 | - $header['Content-Length'] = strlen($content); | 113 | + //查看缩略图是否存在 |
| 114 | + $filename = $this->config['root'] . $info['path'] . '_' . $w . '_' . $h; | ||
| 115 | + if(is_file($filename)){ | ||
| 116 | + $content = file_get_contents($filename); | ||
| 117 | + $header['Content-Length'] = strlen($content); | ||
| 118 | + }else{ | ||
| 119 | + $content = $this->readImageContent($info,$w,$h); | ||
| 120 | + $header['Content-Length'] = strlen($content); | ||
| 121 | + } | ||
| 120 | } | 122 | } |
| 123 | + | ||
| 121 | $header['Content-Type'] = $info['mime']; | 124 | $header['Content-Type'] = $info['mime']; |
| 122 | return response($content,200,$header); | 125 | return response($content,200,$header); |
| 123 | } | 126 | } |
| @@ -135,7 +138,7 @@ class ImageController extends Controller | @@ -135,7 +138,7 @@ class ImageController extends Controller | ||
| 135 | $path = $this->cacheImage($info, $w, $h); | 138 | $path = $this->cacheImage($info, $w, $h); |
| 136 | $content = file_get_contents($path); | 139 | $content = file_get_contents($path); |
| 137 | } else { | 140 | } else { |
| 138 | - $content = file_get_contents($info['path']); | 141 | + $content = file_get_contents($this->config['root'] . $info['path']); |
| 139 | } | 142 | } |
| 140 | return $content; | 143 | return $content; |
| 141 | } | 144 | } |
-
请 注册 或 登录 后发表评论