Committed by
GitHub
Merge pull request #144 from younes0/patch-2
set uploaded images visibility public (relevant for S3 storage)
Showing
1 changed file
with
3 additions
and
1 deletions
| ... | @@ -95,6 +95,7 @@ class ImageService | ... | @@ -95,6 +95,7 @@ class ImageService |
| 95 | 95 | ||
| 96 | try { | 96 | try { |
| 97 | $storage->put($fullPath, $imageData); | 97 | $storage->put($fullPath, $imageData); |
| 98 | + $storage->setVisibility($fullPath, 'public'); | ||
| 98 | } catch (Exception $e) { | 99 | } catch (Exception $e) { |
| 99 | throw new ImageUploadException('Image Path ' . $fullPath . ' is not writable by the server.'); | 100 | throw new ImageUploadException('Image Path ' . $fullPath . ' is not writable by the server.'); |
| 100 | } | 101 | } |
| ... | @@ -167,6 +168,7 @@ class ImageService | ... | @@ -167,6 +168,7 @@ class ImageService |
| 167 | 168 | ||
| 168 | $thumbData = (string)$thumb->encode(); | 169 | $thumbData = (string)$thumb->encode(); |
| 169 | $storage->put($thumbFilePath, $thumbData); | 170 | $storage->put($thumbFilePath, $thumbData); |
| 171 | + $storage->setVisibility($thumbFilePath, 'public'); | ||
| 170 | $this->cache->put('images-' . $image->id . '-' . $thumbFilePath, $thumbFilePath, 60 * 72); | 172 | $this->cache->put('images-' . $image->id . '-' . $thumbFilePath, $thumbFilePath, 60 * 72); |
| 171 | 173 | ||
| 172 | return $this->getPublicUrl($thumbFilePath); | 174 | return $this->getPublicUrl($thumbFilePath); |
| ... | @@ -269,4 +271,4 @@ class ImageService | ... | @@ -269,4 +271,4 @@ class ImageService |
| 269 | } | 271 | } |
| 270 | 272 | ||
| 271 | 273 | ||
| 272 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 274 | +} | ... | ... |
-
Please register or sign in to post a comment