简体   繁体   English

无法使用干预库将图像数据写入 laravel 8 中的路径

[英]Can't write image data to path in laravel 8 using the Intervention library

I'm Using Laravel 8 and I'm Facing this error.我正在使用 Laravel 8 我正面临这个错误。

Can't write image data to path (/home/u520518518/domains/dev.peacockindia.in/public_html/public/Backend/Image/Brand/2003012866_Brand-Image_Mobile_jpg)无法将图像数据写入路径 (/home/u520518518/domains/dev.peacockindia.in/public_html/public/Backend/Image/Brand/2003012866_Brand-Image_Mobile_jpg)

This is My Code这是我的代码

if($request->logo){
    $image = $request->file('logo');
    $img   = rand().'_'.'Brand-Image'.'_'.$request->title.'_'.$image->getClientOriginalExtension();
    $loc   = public_path('Backend/Image/Brand/'.$img);
    Image::make($image)->save($loc);
    $brand->logo   = $img;
}
 $image = $request->file('image');
        $slug = Str::slug($request->name);
        if (isset($image))
        {
            $currentDate = Carbon::now()->toDateString();
            $imagename = $slug.'-'.$currentDate.'-'. uniqid() .'.'. $image->getClientOriginalExtension();
            if (!file_exists('storage/uploads/employee-images'))
            {
                mkdir('storage/uploads/employee-images',0777,true);
            }
            $image->move('storage/uploads/employee-images',$imagename);
        }else{
            $imagename = "default.png";
        }

I tried this我试过这个

$loc   = 'Backend/Image/Brand/'.$img;

and its worked及其工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM