Answers for "laravel intervention save to s3"

PHP
0

laravel intervention save to s3

$file = request()->file('my_input_file_name');

$imageName = $file->getClientOriginalName();

$img = Image::make($file);

$img->resize(null, 1000, function ($constraint) {
    $constraint->aspectRatio();
});

//detach method is the key! Hours to find it... :/
$resource = $img->stream()->detach();

$path = Storage::disk('s3')->put(
    'my-s3-folder/' . $imageName,
    $resource
);
Posted by: Guest on August-13-2021

Browse Popular Code Answers by Language