【问题标题】:'image source not readable' error occurs every time when I use intervention package每次使用干预包时都会出现“图像源不可读”错误
【发布时间】:2021-07-09 09:20:03
【问题描述】:
    $imagePath = (request('image')->store('uploads', 'public'));
     //dd($imagePath);
    $image= Image::make(public_path("storage/{$imagePath}"))->fit(1000,1000);
    $image->save();

    auth()->user()->posts()->create([
        'caption'=>$data['caption'],
        'image'=>$imagePath,
    ]);

这是我的代码,$image 变量没有得到任何东西,它推回错误“图像源不可读”请帮助我。提前致谢 :)

【问题讨论】:

    标签: laravel image path intervention image-file


    【解决方案1】:

    尝试运行php artisan storage:link

    如果存储文件无法访问以从存储文件进行干预,它将起作用。

    【讨论】:

      【解决方案2】:

      尝试使用Storage 外观获取存储的图像。

      $image = Image::make(Storage::disk('public')->get($imagePath))->fit(1000,1000);
      

      【讨论】:

        猜你喜欢
        • 2016-07-09
        • 2017-06-09
        • 2020-04-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-22
        • 1970-01-01
        • 2016-12-19
        相关资源
        最近更新 更多