问题描述
对象上传的文件,
$ dir =>字符串,文件夹名称
$ thumb =>缩略图大小,宽度x高度
* /
函数uploadImage($ file,$ dir,$ thumb = null){
$ path = public_path()。'/ uploads /'.$ dir;
if(!File :: exists($ path)){
File :: makeDirectory($ path,077,true,true);
}
$ image_name = ucfirst($ dir)。“-”。date('Ymdhis')。rand(0,9999)。“。”。$ file-> getClientOriginalExtension();。
$ success = $ file-> move($ path,$ image_name);
if($ success){
if($ thumb){
list($ width,$ height)= explode('x',$ thumb);
图片::: make($ path。'/'。$ image_name)-> resize($ width,$ height,function($ constraint){
返回$ constraint-> aspectRation();
})-> save($ path。'/ Thumb-'。$ image_name);
}
返回$ image_name;
}
其他{
返回false;
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)