user9334443
user9334443

Reputation:

Laravel - Intervention Image - Image source not readable

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 ?

Upvotes: 3

Views: 7510

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163748

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

Image::make(storage_path('uploads/'. $new_name'))

Upvotes: 3

Related Questions