使用Jcrop来实现头像裁剪
打赏作者

sean90

裁剪弹框出来后,左上角有个,单选框

JellyBool 回复 sean90

这可能是这个插件的问题,你用 css 设置它 display none就可以了

chenxin

我必须的用photo=strstr(photo=strstr(request->get(‘photo’),‘uploads’);这句话将获取到的图片地址由
http://localhost:81/Laravel/laravel-community/public/uploads/33_14740152448.jpg转化为
uploads/33_14740152448.jpg 才能显示。否则会出现
NotWritableException in Image.php line 134:
Can’t write to undefined path.这种错误提示

JellyBool 回复 chenxin

额,第一,可能就是你的权限不够。第二,是你的 web 服务器没有配置好根路径吧,所以才会出现这样的各种各样的奇怪问题,相信之前的 css 文件也是这样引起的

chenxin 回复 JellyBool

权限我用chmod没问题的,可能还 是路径问题。哎,不过效果也能实现,我前几个月没用框架做了一个类似云盘的项目,遇到最多的问题也是路径问题.

xlkit456852

根据视频代码走,裁剪框内的图片会裁得不完整
qq 20170110160038

JellyBool 回复 xlkit456852

chrome 开发者工具看看 css 样式,有没有哪设置了图片的宽和高吧

hate

photo=photo =request->get(‘photo’);

    $width  =  (int)$request->get('w');
    $height =  (int)$request->get('h');
    $xAlign =  (int)$request->get('x');
    $yAlign =  (int)$request->get('y');

    Image::make($photo)->crop($width,$height,$xAlign,$yAlign)->save();
    $user  = \Auth::user();

    $user->avatar = $request->get('photo');

    $user->save();

    return redirect('users/avatar');

$photo 的值是"http://localhost/community/public/uploads/32_1498146253zhuomian.jpg"
无法写入未定义路径是什么鬼

JellyBool 回复 hate

你给一下写入的权限,或者说你的这么目录就不存在吧

hate 回复 JellyBool

权限是有的 ,无法写入未定义路径,我dd($photo)那个地址我在游览器打开就能看到图片

JellyBool 回复 hate

你使用 public_path() 来指定路径,不要使用 http 协议撒

hate 回复 JellyBool

你把代码贴出来呗。嘻嘻,

JellyBool 回复 hate

额,视频不是有代码的么?

hate 回复 JellyBool

不知道在哪指定

hate

Can’t write to undefined path.

myhyperion 回复 hate

就是视频里 那些 ‘/’ 捣鬼的

王誌鵬

NotReadableException
Unable to init from given binary data.

JellyBool 回复 王誌鵬

注意你的图片文件路径