我遇到了一个相当有趣的问题。在我的本地主机上,一切似乎都正常运行,但是在将项目托管在实时服务器上后,我遇到了这个错误
(1/1)NotWritableException 无法将图像数据写入路径(/home/floatin2/public_html/public/avatar/band11.png)
这是我的代码:
$imageData=$request->get('image-data');
$imageData2=$request->get('second-image-data');
$imageData3=$request->get('third-image-data');
$info=base64_decode(preg_replace('#^data:image/\w+;base64,#i', '',$imageData));
$info2=base64_decode(preg_replace('#^data:image/\w+;base64,#i', '',$imageData2));
$info3=base64_decode(preg_replace('#^data:image/\w+;base64,#i', '',$imageData3));
$img1=Image::make($info)->save(public_path('/avatar/band1'. auth()->user()->id .'.png'));
$img2=Image::make($info2)->save(public_path('/avatar/band2'. auth()->user()->id .'.png'));
$img3=Image::make($info3)->save(public_path('/avatar/band3'. auth()->user()->id .'.png'));
$user=Auth::user();
$user->avatarband1='band1'. auth()->user()->id .'.png';
$user->avatarband2='band2'. auth()->user()->id .'.png';
$user->avatarband3='band3'. auth()->user()->id .'.png';
$user->save();
请告诉我如何解决此问题