Reputation: 543
I am facing some issues with GD in a laravel project. My phpinfo says that GD is enabled but I get an "undefined function Intervention\Image\Gd\imagecreatefrompng()" error.
I am facong the issues when I try to execute this:
public function update(Request $request, $id)
{
//Show the image
echo '<img src="'.$_POST['img_val'].'" />';
//Get the base-64 string from data
$filteredData=substr($_POST['img_val'], strpos($_POST['img_val'], ",")+1);
//Decode the string
$unencodedData=base64_decode($filteredData);
//Save the image
$storagepath = storage_path('app/images/users/' . Auth::user()->id);
$imgoutput = File::put($storagepath.'/flyer2.png', $unencodedData);
return view('backend.flyers.index')->withImgoutput($imgoutput);
//->withStoragepath($storagepath);
}
Upvotes: 1
Views: 646
Reputation: 31
It looks like your GD installation doesn't have support for PNG images. That should be listed along the GD section of your phpinfo()
.
Which PHP version are you using?
From the documentation:
To enable support for png add
--with-png-dir=DIR
. Note, libpng requires the zlib library, therefore add--with-zlib-dir[=DIR]
to your configure line. As of PHP 7.4.0,--with-png-dir
and--with-zlib-dir
have been removed. libpng and zlib are required.
There's a chance you need to install libpng
and zlib
on your system.
Upvotes: 2