@@ -14,6 +14,9 @@ |
||
14 | 14 | public $cacheKey; |
15 | 15 | protected $_metadata; |
16 | 16 | |
17 | + /** |
|
18 | + * @param string|null $url |
|
19 | + */ |
|
17 | 20 | public function __construct($url, $maxHeight = 0, AdapterInterface $filesystem = null, ImageManager $imageManager = null) |
18 | 21 | { |
19 | 22 | $this->sourceUrl = $url; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->imageManager = $imageManager ?: app('Intervention\Image\ImageManager'); |
23 | 23 | $maxAge = 3153600; // 30 days |
24 | 24 | $this->fsConfig = new FlysystemConfig([ |
25 | - 'CacheControl' => 'max-age=' . $maxAge . ', public', |
|
25 | + 'CacheControl' => 'max-age='.$maxAge.', public', |
|
26 | 26 | ]); |
27 | 27 | } |
28 | 28 | |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | if (is_null($data)) { |
93 | 93 | $data = $this->download(); |
94 | 94 | if (!$data) { |
95 | - throw new \ErrorException('[CoverCache] Failed to download ' . $this->sourceUrl); |
|
95 | + throw new \ErrorException('[CoverCache] Failed to download '.$this->sourceUrl); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | 99 | $img = $this->imageManager->make($data); |
100 | 100 | if ($this->maxHeight && $img->height() > $this->maxHeight) { |
101 | - \Log::debug('[CachedImage] Resizing from ' . $img->height() . ' to ' . $this->maxHeight); |
|
101 | + \Log::debug('[CachedImage] Resizing from '.$img->height().' to '.$this->maxHeight); |
|
102 | 102 | $img->heighten($this->maxHeight); |
103 | 103 | $data = strval($img->encode('jpg')); |
104 | 104 | } |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | |
110 | 110 | $this->setMetadata($data, $img); |
111 | 111 | |
112 | - \Log::debug('[CachedImage] Storing image as ' . $img->width() . ' x ' . $img->height() . ', ' . strlen($data) . ' bytes'); |
|
112 | + \Log::debug('[CachedImage] Storing image as '.$img->width().' x '.$img->height().', '.strlen($data).' bytes'); |
|
113 | 113 | if (!$this->filesystem->write($this->cacheKey, $data, $this->fsConfig)) { |
114 | 114 | throw new \ErrorException('[CoverCache] Failed to upload thumb to S3'); |
115 | 115 | } |
116 | 116 | |
117 | - \Log::debug('[CachedImage] Wrote cached version as ' . $this->cacheKey); |
|
117 | + \Log::debug('[CachedImage] Wrote cached version as '.$this->cacheKey); |
|
118 | 118 | |
119 | 119 | return $this; |
120 | 120 | } |