Intervention / Image Upload Error Image source not readable

Published 1 week ago by vinodsharma

Hii, I am new to laravel and I am facing a problem when uploading an image. I am already using " enctype="multipart/form-data " in the form. I have saved an image and want to resize, but showing error Image source not readable. I am using Laravel 5.4. This is what I am doing in Controller

            $image = $request->file('employee_image');
        $salt1      = bin2hex(openssl_random_pseudo_bytes(22));
        $getimageName = $salt1.'.'.$image->getClientOriginalExtension();
        $destinationPath = public_path('employeeimages');
        $image->move($destinationPath, $getimageName);
        // open an image file
        $img = Image::make($request->file('employee_image')->getRealPath());
        // now you are able to resize the instance
        $img->resize(128, 128);
        $img->save('employeeimages'.$getimageName);
Best Answer (As Selected By vinodsharma)
edoc
edoc
edoc
1 week ago (64,250 XP)

you can wrap your code with three backticks

edoc
edoc
1 week ago (64,250 XP)
edoc
edoc
1 week ago (64,250 XP)

can you try this ? $img = Image::make($request->file('employee_image'));

vinodsharma

No This is not working.

edoc
edoc
1 week ago (64,250 XP)
vinodsharma

Thank you, Its give me right direction to rectify this issue

Please sign in or create an account to participate in this conversation.