小编Deb*_*Roy的帖子

Intervention\Image\Exception\NotSupportedException 不支持编码格式 (tmp)

我在 Laravel 5.6 中使用干预包,每当我上传文件时都会遇到这个问题,我遇到了错误编码格式(tmp)不受支持。我也启用了我的 gdd2 扩展。这是我使用过的代码。

public function store(Request $request)
    {
        $this->validate($request , [
            'name'          => 'required|unique:categories',
            'description'   =>  'max:355',
            'image'         =>  'required|image|mimes:jpeg,bmp,png,jpg'
        ]);

        // Get Form Image
        $image = $request->file('image');
        $slug = str_slug($request->name);
        if (isset($image))
        {
            $currentDate = Carbon::now()->toDateString();
            $imageName = $slug.'-'.$currentDate.'-'.uniqid().'.'.$image->getClientOriginalExtension();
            // Check if Category Dir exists
            if (!Storage::disk('public')->exists('category'))
            {
                Storage::disk('public')->makeDirectory('category');
            }
            // Resize image for category and upload
            $categoryImage = Image::make($image)->resize(1600,479)->save();
            Storage::disk('public')->put('category/'.$imageName, $categoryImage);

            // Check if Category Slider Dir exists
            if (!Storage::disk('public')->exists('category/slider'))
            {
                Storage::disk('public')->makeDirectory('category/slider');
            }

            // Resize …
Run Code Online (Sandbox Code Playgroud)

laravel intervention

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

intervention ×1

laravel ×1