@@ -52,17 +52,17 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * File not cached |
| 54 | 54 | */ |
| 55 | - else{ |
|
| 55 | + else { |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Get META information |
| 59 | 59 | */ |
| 60 | - $imageMeta = Image::where(['url' => $request->imageName, 'image_extension' => $request->imageExtension])->first(['image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag']); |
|
| 60 | + $imageMeta = Image::where([ 'url' => $request->imageName, 'image_extension' => $request->imageExtension ])->first([ 'image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag' ]); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * File does not exist |
| 64 | 64 | */ |
| 65 | - if(empty($imageMeta) == TRUE){ |
|
| 65 | + if (empty($imageMeta) == TRUE) { |
|
| 66 | 66 | App::abort(404); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | 'Content-Type' => $imageMeta->image_mime_type, |
| 92 | 92 | 'Content-Transfer-Encoding' => 'binary', |
| 93 | 93 | 'Pragma' => 'public', |
| 94 | - 'Expires' => Carbon::createFromTimestamp(time()+3600)->toRfc2822String(), |
|
| 94 | + 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), |
|
| 95 | 95 | 'Last-Modified' => $imageMeta->updated_at->toRfc2822String(), |
| 96 | 96 | 'Etag' => $imageMeta->image_etag, |
| 97 | 97 | ); |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Response code cached |
| 101 | 101 | */ |
| 102 | - if( (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag) |
|
| 103 | - || (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) ){ |
|
| 102 | + if ((isset($_SERVER[ 'HTTP_IF_NONE_MATCH' ]) && $_SERVER[ 'HTTP_IF_NONE_MATCH' ] == $imageMeta->image_etag) |
|
| 103 | + || (isset($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ]) && $_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ] == $imageMeta->updated_at->toRfc2822String())) { |
|
| 104 | 104 | |
| 105 | 105 | $responseCode = 304; |
| 106 | 106 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * Response code not cached, but OK |
| 110 | 110 | */ |
| 111 | - else{ |
|
| 111 | + else { |
|
| 112 | 112 | |
| 113 | 113 | $responseCode = 200; |
| 114 | 114 | } |