Correctly add photos to S3
This commit is contained in:
parent
842dbfa87b
commit
5bfe8c5a97
3 changed files with 26 additions and 5 deletions
|
@ -141,10 +141,12 @@ class NotesController extends Controller
|
|||
$note->placeLink = '/places/' . $note->place->slug;
|
||||
}
|
||||
|
||||
$note->photoURLs = [];
|
||||
foreach ($note->getMedia() as $photo) {
|
||||
$note->photoURLs[] = $photo->getUrl();
|
||||
$photoURLs = [];
|
||||
$photos = $note->getMedia();
|
||||
foreach ($photos as $photo) {
|
||||
$photoURLs[] = $photo->getUrl();
|
||||
}
|
||||
$note->photoURLs = $photoURLs;
|
||||
|
||||
return view('singlenote', [
|
||||
'note' => $note,
|
||||
|
|
|
@ -64,7 +64,7 @@ class NoteService
|
|||
if ($request->hasFile('photo')) {
|
||||
$files = $request->file('photo');
|
||||
foreach ($files as $file) {
|
||||
$note->addMedia($file)->toMediaLibrary('images', 's3');
|
||||
$note->addMedia($file)->toCollectionOnDisk('images', 's3');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,12 @@ return [
|
|||
* When urls to files get generated this class will be called. Leave empty
|
||||
* if your files are stored locally above the site root or on s3.
|
||||
*/
|
||||
'custom_url_generator_class' => '',
|
||||
'custom_url_generator_class' => null,
|
||||
|
||||
/*
|
||||
* The class that contains the strategy for determining a media file's path.
|
||||
*/
|
||||
'custom_path_generator_class' => null,
|
||||
|
||||
's3' => [
|
||||
/*
|
||||
|
@ -37,4 +42,18 @@ return [
|
|||
*/
|
||||
'domain' => env('AWS_S3_URL'),
|
||||
],
|
||||
|
||||
'remote' => [
|
||||
/**
|
||||
* Any extra headers that should be included when uploading media to
|
||||
* a remote disk. Even though supported headers may vary between
|
||||
* different drivers, a sensible default has been provided.
|
||||
*
|
||||
* Supported by S3: CacheControl, Expires, StorageClass,
|
||||
* ServerSideEncryption, Metadata, ACL, ContentEncoding
|
||||
*/
|
||||
'extra_headers' => [
|
||||
'CacheControl' => 'max-age=604800',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue