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->placeLink = '/places/' . $note->place->slug;
|
||||||
}
|
}
|
||||||
|
|
||||||
$note->photoURLs = [];
|
$photoURLs = [];
|
||||||
foreach ($note->getMedia() as $photo) {
|
$photos = $note->getMedia();
|
||||||
$note->photoURLs[] = $photo->getUrl();
|
foreach ($photos as $photo) {
|
||||||
|
$photoURLs[] = $photo->getUrl();
|
||||||
}
|
}
|
||||||
|
$note->photoURLs = $photoURLs;
|
||||||
|
|
||||||
return view('singlenote', [
|
return view('singlenote', [
|
||||||
'note' => $note,
|
'note' => $note,
|
||||||
|
|
|
@ -64,7 +64,7 @@ class NoteService
|
||||||
if ($request->hasFile('photo')) {
|
if ($request->hasFile('photo')) {
|
||||||
$files = $request->file('photo');
|
$files = $request->file('photo');
|
||||||
foreach ($files as $file) {
|
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
|
* 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.
|
* 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' => [
|
's3' => [
|
||||||
/*
|
/*
|
||||||
|
@ -37,4 +42,18 @@ return [
|
||||||
*/
|
*/
|
||||||
'domain' => env('AWS_S3_URL'),
|
'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