3

I want to resize my images with Intervention Image package, but When I tried it gives me that error.

Intervention \ Image \ Exception \ NotReadableException
Image source not readable

My codes;

if ($request->hasFile('featured_image')) {

    $realname = pathinfo($request->file('featured_image')->getClientOriginalName(), PATHINFO_FILENAME);
    $extension = $request->file('featured_image')->getClientOriginalExtension();
    $new_name = $realname."-".time().".".$extension;
    $request->file('featured_image')->storeAs('public/uploads',$new_name);
    $path = Storage::url('uploads/'.$new_name);
    $post->featured_image = $path;
    Image::make($path)->resize(320, 240)->insert($path);
}

How can I fix this ?

Banana
  • 2,435
  • 7
  • 34
  • 60

1 Answers1

3

Use the full path to the image instead of URL, for example:

Image::make(storage_path('uploads/'. $new_name'))
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279