mercredi 28 juin 2017

Laravel5 Intervention Image NotReadableException

I'm trying to upload images with gd driver, for profiles or posts, on my laravel project on live server but always have this error:

NotReadableException Unable to read image from file (). in Decoder.php (line 20)

My upload works in local but not on this live server, I don't know why and I already tried changing the function, using imagick driver (the installation was successful but the upload is so slow that I get timed out), and editing the php.ini (5.6). Here is my upload post image code:

$image = $request->file('image');

if($image)
        {
        Image::configure(array('driver' => 'gd'));

        $filename  = $user->role . '-' . $user->id . '-' . time() . '.jpg';

        $path = public_path('uploads/posts/' . $filename);

        $filepath = 'uploads/posts/' . $filename;

        Image::make($image)->resize(800, 600, function ($constraint) {
            $constraint->aspectRatio();
        })->save($path);

        $post->image = $filepath;
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire