Tuesday, 2 July 2019

Uploading to S3 with Laravel Intervention image returns boolean and not path

I am having an issue with uploading an image in Laravel. Sometimes the image needs reorienting - when doing this with Intervention image it simply returns a boolean instead of the path of the image in s3. When using it without Intervention Image it works fine

I've tried exif reading data and using imagerotate to no avail, it errors out

I run the following

$image = $request->file('photo');
$path = \Storage::disk('s3')->put('users/'.\Auth::id().'/posts', $image, 'public');
dd($path); // /users/1/posts/39grjigrje.jpg

the $path variable is great and is the s3 path, however running:

$image = $request->file('photo');
$image = \Image::make($image);
$image->orientate();
$path = \Storage::disk('s3')->put('users/'.\Auth::id().'/posts', $image, 'public');
dd($path); // true

the $path variable is simply just a boolean and doesn't return the stored file path

I expect a path e.g. /images/1/kfjeieuge.jpg which I get when i don't use intervention image, when I use intervention I get a boolean.



from Uploading to S3 with Laravel Intervention image returns boolean and not path

No comments:

Post a Comment