无法从给定的二进制数据初始化 [英] Unable to init from given binary data

查看:797
本文介绍了无法从给定的二进制数据初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Intervention Image保存由base64编码的图像,laravel-5异常告诉我无法从给定的二进制数据初始化". 有人可以帮忙吗?

I'm trying to save image encoded by base64 using Intervention Image, laravel-5 Exception told me that "Unable to init from given binary data". anyone can help?

$png_url = "user-".time().".png";
$path = "/public/".$png_url;
Image::make(base64_encode($request['image']))->save($path);

推荐答案

<?php
$png_url = "user-".time().".png";
$path = "/public/".$png_url;
$base=base64_decode($request['image']);
Image::make($base)->save($path);
?>

这篇关于无法从给定的二进制数据初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆