Laravel尝试调整本地图像的大小Intervention \ Image \ Exception \ NotReadableException:

时间:2016-11-12 15:39:58

标签: php image laravel

我正在尝试使用队列调整大小并上传本地图像但我收到错误:

干预\ Image \ Exception \ NotReadableException:/ home / forge / default / vendor / intervention / image / src / Interventio $ Stack trace中不可读取的图像源:#0 / home / forge / default / vendor / intervention / image /src/Intervention/Image/AbstractDriver.php(64):干预\ Image \ AbstractDecoder-> init('/ tmp / phpcpMqyA')#1 / home / forge / default / vendor / intervention / image / src / Intervention / Image / ImageManager.php(50):干预\ Image \ AbstractDriver-> init('/ tmp / phpcpMqyA')#2 / home / forge / default / vendor / laravel / framework / src / Illuminate / Support / Facades / Facade .php(217):干预\ Image \ ImageManager-> make('/ tmp / phpcpMqyA')#3 /home/forge/default/app/Jobs/UploadImagesThumb.php(35):照亮\支持\外墙\外观:: __ callStatic('make',Array)

我的功能如下:

$extension = $file->guessExtension();
      $filename = 'thumnail_'.$id.'.'.$extension;
      if ($file) {
          $s3 = Storage::disk('local')->put($filename, $file);
      }
      $this->dispatch(new UploadImagesThumb($filename, $id));

这就是我的队列(UploadImagesThumb)

public function handle()
    {
        $image = Storage::disk('public')->get($this->filename);

        $s3 = Storage::disk('s3');
        $imageThumb = Image::make($image)->fit(320);
        //Always set thumbnail as jpg
        $imageThumb->encode('jpg');
        $s3->put("images/{$this->id}/thumb/thumbnail.jpg", (string) $imageThumb, 'public');
    }

但是,如果我不使用我的队列,而是在我的模型中进行调整大小/上传,它将起作用。

0 个答案:

没有答案