作者 lyh

gx

@@ -107,10 +107,11 @@ class ImageController extends Controller @@ -107,10 +107,11 @@ 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 + $content = file_get_contents($filename);
  111 + $header['Content-Length'] = strlen($content);
110 }else{ 112 }else{
111 //查看缩略图是否存在 113 //查看缩略图是否存在
112 $filename = $this->config['root'] . $info['path'] . '_' . $w . '_' . $h; 114 $filename = $this->config['root'] . $info['path'] . '_' . $w . '_' . $h;
113 - }  
114 if(is_file($filename)){ 115 if(is_file($filename)){
115 $content = file_get_contents($filename); 116 $content = file_get_contents($filename);
116 $header['Content-Length'] = strlen($content); 117 $header['Content-Length'] = strlen($content);
@@ -118,6 +119,8 @@ class ImageController extends Controller @@ -118,6 +119,8 @@ class ImageController extends Controller
118 $content = $this->readImageContent($info,$w,$h); 119 $content = $this->readImageContent($info,$w,$h);
119 $header['Content-Length'] = strlen($content); 120 $header['Content-Length'] = strlen($content);
120 } 121 }
  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 }