'Intervention \ Image \ Exception \ NotReadableException Image source not readable
I am trying to resize images using the intervention package, but I keep on getting the error, whenever I refresh the browser page. I have already added Intervention\Image\ImageServiceProvider::class, to the providers section and, 'Image' => Intervention\Image\Facades\Image::class, to the aliases section of config/app.php file.
if($request->hasfile('image'))
{
$imagePath = $request->file('image');
$extension = $imagePath->getClientOriginalExtension();
$filename = time().'.'.$extension;
$imagePath->storeAs('public/uploads/', $filename);
}
$image = Image::make(public_path("public/uploads/{$imagePath}"))->fit(1200,1200);
$image->save();
Solution 1:[1]
You don't need to add "public" with the public_path() function (unless you actually have a "public" folder inside Laravel's public folder.
So your file path should probably be:
public_path("uploads/{$imagePath}")
If it still doesn't work, echo out the path to check if it's correct.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Thomas |
