0
嗨我在我的laravel
项目中使用滑行(http://glide.thephpleague.com/)进行图像处理。 我在存储图像时遇到了一个问题。 “调用未定义函数Intervention\Image\Gd\imagecreatefrompng()
”Laravel调用未定义的函数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);
}
好像文件::放(XXX JPG)JPG导致该问题。 我该如何解决这个问题?
用php --ini我得到这个错误消息:PHP警告:PHP启动:无法加载动态库'/usr/lib/php/extensions/no-debug-non-zts-20121212/php_gd2.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_gd2.dll,9):在未知的行0中找不到图像 – Mamulasa
库缺失,安装它 –
顺便说一句。我在Mac上,不是.dll文件只适用于Windows? – Mamulasa