![](/img/trans.png)
[英]GD LIbrary on a Mac: "undefined function Intervention\Image\Gd\imagecreatefrompng()"
[英]Laravel Call to undefined function Intervention\Image\Gd\imagecreatefrompng()
嗨,我在laravel
项目中使用 glide ( http://glide.thephpleague.com/ ) 进行图像处理。 我在存储图像时遇到问题。 “调用未定义的函数Intervention\\Image\\Gd\\imagecreatefrompng()
”
奇怪的是,我可以在我的 mac 上用“预览”打开图像。 但不是在浏览器中。 Photoshop 还告诉我这个文件有问题,它已损坏。
这是我将图像保存在私人文件夹中的方式:
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.'/flyer.jpg', $unencodedData);
return view('backend.flyers.index')->withImgoutput($imgoutput);
//->withStoragepath($storagepath);
}
似乎 File::put( XXX.jpg ) JPG导致了问题。 我怎样才能解决这个问题?
这是因为缺少GD Library
。 尝试这个:
您必须启用库 GD2。
找到你的(正确的) php.ini
文件
找到这一行: ;extension=php_gd2.dll
,去掉前面的分号。
该行应如下所示:
extension=php_gd2.dll
然后重新启动apache,你应该很高兴。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.