'image source not readable' error occurs every time when I use intervention package

797 views Asked by At
    $imagePath = (request('image')->store('uploads', 'public'));
     //dd($imagePath);
    $image= Image::make(public_path("storage/{$imagePath}"))->fit(1000,1000);
    $image->save();

    auth()->user()->posts()->create([
        'caption'=>$data['caption'],
        'image'=>$imagePath,
    ]);

this is my code the $image variable is not getting anything and it push back the error "image source not readable" kindly help me in this. Thanks in Advance :) the error

2

There are 2 answers

0
jrcamatog On

Try getting the stored image using the Storage facade.

$image = Image::make(Storage::disk('public')->get($imagePath))->fit(1000,1000);
0
Vishnu On

Try running php artisan storage:link.

It will work if storage files not accessible for intervening from the stored file.