phplaravelintervention

GD Library extension not available with this PHP installation -- when using Intervention Image


Controller File:

use Image;

if ($request->file('dp')) {
        $image = $request->file('dp');
        $img_name = hexdec(uniqid('', true)).'.'.$image->getClientOriginalExtension();
        Image::make($image)->resize(150,150)->save('upload/employee_Img/'.$img_name);
        $image_path = 'upload/employee_Img/'.$img_name;
    }

Employees::insert([
        'dp' => $image_path,
        'created_at' => Carbon::now()
    ]);

It was returning an error saying -- GD Library extension not available with this PHP installation.


Solution

  • Go to XAMPP control panel. Then press the config button on beside apache start button. From there go to php.ini file. Then search for gd or gd2 and remove the quatation before the following line - ;extension=gd -> extension=gd.

    Restart the apache and mysql server and you're good to go.

    [find the php.ini file here][1]