我在一个laravel项目中遇到了一些GD方面的问题。

当我尝试执行以下代码时,我会面对这些问题:
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);
}发布于 2021-10-25 14:40:22
看起来你的GD安装不支持PNG镜像。它应该列在phpinfo()的GD部分。
您使用的是哪个PHP版本?
要启用对png的支持,请添加--with-png-dir=DIR。注意,libpng需要zlib库,因此将--with-zlib-dir[=DIR]添加到您的配置行。从PHP7.4.0开始,--with-png-dir和--with-zlib-dir已经被移除。zlib和是必需的。
您可能需要在系统上安装libpng和zlib。
https://stackoverflow.com/questions/39769590
复制相似问题