|
@@ -59,23 +59,23 @@ class ImageController |
|
@@ -59,23 +59,23 @@ class ImageController |
|
59
|
[$last_modified_time, $hash . ':' . $w . '_' . $h . '_' . 2, $last_modified_time], $this->upload_img['header']);
|
59
|
[$last_modified_time, $hash . ':' . $w . '_' . $h . '_' . 2, $last_modified_time], $this->upload_img['header']);
|
|
60
|
$content = file_get_contents($filename);
|
60
|
$content = file_get_contents($filename);
|
|
61
|
$header['Content-Length'] = $info['size'];
|
61
|
$header['Content-Length'] = $info['size'];
|
|
62
|
- return response($content, 200, $header);
|
|
|
|
63
|
- }
|
|
|
|
64
|
- $path = $info['path'];
|
|
|
|
65
|
- if (!is_file($path)) {
|
|
|
|
66
|
- $this->response('指定图片已被系统删除!', Code::USER_ERROR);
|
|
|
|
67
|
- }
|
|
|
|
68
|
- $content = '';
|
|
|
|
69
|
- $last_modified_time = gmdate(time() + ((30 * 60 * 60 * 24))) . " GMT";
|
|
|
|
70
|
- $header = str_replace(['%Expires%', "%etag%", '%Last-Modified%'],
|
|
|
|
71
|
- [$last_modified_time, $hash . ':' . $w . '_' . $h . '_' . 2, $last_modified_time], $this->upload_img['header']);
|
|
|
|
72
|
- if ($w > 0 && $h > 0) {
|
|
|
|
73
|
- $path = $this->cacheImage($info, $w, $h);
|
|
|
|
74
|
- $content = file_get_contents($path);
|
|
|
|
75
|
- $header['Content-Length'] = strlen($content);
|
|
|
|
76
|
- } else {
|
|
|
|
77
|
- $content = file_get_contents($path);
|
|
|
|
78
|
- $header['Content-Length'] = $info['size'];
|
62
|
+ }else{
|
|
|
|
63
|
+ $path = $info['path'];
|
|
|
|
64
|
+ if (!is_file($path)) {
|
|
|
|
65
|
+ $this->response('指定图片已被系统删除!', Code::USER_ERROR);
|
|
|
|
66
|
+ }
|
|
|
|
67
|
+ $content = '';
|
|
|
|
68
|
+ $last_modified_time = gmdate(time() + ((30 * 60 * 60 * 24))) . " GMT";
|
|
|
|
69
|
+ $header = str_replace(['%Expires%', "%etag%", '%Last-Modified%'],
|
|
|
|
70
|
+ [$last_modified_time, $hash . ':' . $w . '_' . $h . '_' . 2, $last_modified_time], $this->upload_img['header']);
|
|
|
|
71
|
+ if ($w > 0 && $h > 0) {
|
|
|
|
72
|
+ $path = $this->cacheImage($info, $w, $h);
|
|
|
|
73
|
+ $content = file_get_contents($path);
|
|
|
|
74
|
+ $header['Content-Length'] = strlen($content);
|
|
|
|
75
|
+ } else {
|
|
|
|
76
|
+ $content = file_get_contents($path);
|
|
|
|
77
|
+ $header['Content-Length'] = $info['size'];
|
|
|
|
78
|
+ }
|
|
79
|
}
|
79
|
}
|
|
80
|
$img_type = $info['type'];
|
80
|
$img_type = $info['type'];
|
|
81
|
$content = base64_encode($content);
|
81
|
$content = base64_encode($content);
|