Feature, upload media to S3 as part of micropub request
Squashed commit of the following:
commit 1f1175a4d944f573868dc2282e62fbd1b4e88b6a
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date: Sun Apr 22 18:46:02 2018 +0100
Fix file upload tests to reflect that we have now inlined the file upload to S3
commit 40d2af5b76e8f390d0275830390dd89ab4d12f54
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date: Sun Apr 22 18:45:20 2018 +0100
Markup the bookmrark test that uses puppeteer, doesn’t play nicely with my old MacBook and let’s me skip that one test
commit bbae1557c87d4d8f3b324abda1a6b8bf66acb8d8
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date: Sun Apr 22 17:56:25 2018 +0100
Inline the S3 upload for media
Smaller images can then be uploaded by the ProcessMedia job. Inline-ing
the upload prevents an S3 URL being sent that will initially 404.
This commit is contained in:
parent
b097dc0f94
commit
8b5b3204c1
4 changed files with 32 additions and 11 deletions
|
|
@ -6,6 +6,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use Monolog\Logger;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Illuminate\Http\File;
|
||||
use App\Jobs\ProcessMedia;
|
||||
use App\Services\TokenService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
|
@ -203,6 +204,13 @@ class MicropubController extends Controller
|
|||
'image_widths' => $width,
|
||||
]);
|
||||
|
||||
// put the file on S3 initially, the ProcessMedia job may edit this
|
||||
Storage::disk('s3')->putFileAs(
|
||||
'media',
|
||||
new File(storage_path('app') . '/' . $filename),
|
||||
$filename
|
||||
);
|
||||
|
||||
ProcessMedia::dispatch($filename);
|
||||
|
||||
return response()->json([
|
||||
|
|
|
|||
Loading…
Reference in a new issue