Running Laraval 5.4 with Vagrant and Homestead.
Saw a few other questions regarding this issue but none provided a solution which uses the canvas() method by Intervention/Image
My current code:
$path = $request->file('logo')->store('/clients/logos','public');
$canvas = Image::canvas($width, $height);
$image = Image::make($path)->resize($width, $height, function ($constraint)
{
$constraint->aspectRatio();
});
$canvas->insert($image, 'center');
$canvas->save($path);
$this->logo_path = $path;
This code creates a canvas and places a resized image inside it.
This code gives following error:
NotReadableException in AbstractDecoder.php line 335: Image source not
readable in AbstractDecoder.php line 335 at
AbstractDecoder->init('clients/logos/UupUn1iuDGRsy5Z0bkWHJ6S4v79bfZiXapTO7vLk.jpeg')
in AbstractDriver.php line 64
The first line works, because the image is stored inside my storage folder at the following location:
"/storage/app/public/clients/logo/UupUn1iuDGRsy5Z0bkWHJ6S4v79bfZiXapTO7vLk.jpeg"
but the image is stored in full-size, so the code fails at the image-intervention part.
Things i tried:
I tried changing the $path variable inside Image::make() to this:
Storage::disk('public')->url($path)
which results in following error:
Can't write image data to path
(http://test.dev/storage/clients/logos/owjNA5Fn9QyYoS0i84UgysaFLo5v0NzbOiBhBzXp.jpeg)
The weird part about that error is that the 'app' directory is not visible inside that error.
I'm running out of ideas to solve this issue.