samedi 31 décembre 2016

laravel NotReadableException in Decoder.php - Unable to read image from file

So I am getting this error. After searching the internet it looks like the issue could be with the post_upload_size and post_size, but that's not it. I upload larger images that work fine, then this image that has 1.5MB is not working. It's like it's random. It works for some, but not for all images. Here's the full output.

Whoops, looks like something went wrong. 1/1 NotReadableException in Decoder.php line 46: Unable to read image from file (/tmp/phpVpVQeP).

in Decoder.php line 46
at Decoder->initFromPath('/tmp/phpVpVQeP') in AbstractDecoder.php line 293
at AbstractDecoder->init('/tmp/phpVpVQeP') in AbstractDriver.php line 64
at AbstractDriver->init('/tmp/phpVpVQeP') in ImageManager.php line 50
at ImageManager->make('/tmp/phpVpVQeP') in Facade.php line 215
at Facade::__callStatic('make', array('/tmp/phpVpVQeP')) in ProfileController.php line 251
at Image::make('/tmp/phpVpVQeP') in ProfileController.php line 251
at ProfileController->sendProfile(object(Request), 'klaughlin')
at call_user_func_array(array(object(ProfileController), 'sendProfile'), array(object(Request), 'username' => 'klaughlin')) in Controller.php line 256
at Controller->callAction('sendProfile', array(object(Request), 'username' => 'klaughlin')) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(ProfileController), object(Route), 'sendProfile') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(ProfileController), object(Route), object(Request), 'sendProfile') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\ProfileController', 'sendProfile') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 708
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 710
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Cors.php line 18
at Cors->handle(object(Request), object(Closure))
at call_user_func_array(array(object(Cors), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54

Here is my var_dump

object(Symfony\Component\HttpFoundation\File\UploadedFile)#30 (7) { ["test":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> bool(false) ["originalName":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(19) "20160212_124938.jpg" ["mimeType":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(10) "image/jpeg" ["size":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> int(1606199) ["error":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> int(0) ["pathName":"SplFileInfo":private]=> string(14) "/tmp/phpVpVQeP" ["fileName":"SplFileInfo":private]=> string(9) "phpVpVQeP" } string(14) "1483214733.jpg" string(76) "/home/laughlindavid/public_html/http://ift.tt/2ipj2i8"

It is odd how it just does this with certain images.

Here is the code in my controller.

        $image = Input::file('picture');
        var_dump($image);
        $filename  = time() . '.' . $image->getClientOriginalExtension();
        var_dump($filename);
        $path = public_path('profilepics/' . $filename);

var_dump($path);

            Image::make($image->getRealPath())->resize(200, 200)->save($path);
       }



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2itvWOt
via IFTTT

Aucun commentaire:

Enregistrer un commentaire