Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kekekiw123's avatar

Trying to resize local image

I am trying to resize and upload a local image using a queue but I get the error:

Intervention\Image\Exception\NotReadableException: Image source not readable in /home/forge/default/vendor/intervention/image/src/Interventio$ Stack trace: #0 /home/forge/default/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php(64): Intervention\Image\AbstractDecoder->init('/tmp/phpcpMqyA') #1 /home/forge/default/vendor/intervention/image/src/Intervention/Image/ImageManager.php(50): Intervention\Image\AbstractDriver->init('/tmp/phpcpMqyA') #2 /home/forge/default/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(217): Intervention\Image\ImageManager->make('/tmp/phpcpMqyA') #3 /home/forge/default/app/Jobs/UploadImagesThumb.php(35): Illuminate\Support\Facades\Facade::__callStatic('make', Array)

My functions looks like this:

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

And this is what my queue (UploadImagesThumb) does

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');
    }

But if I dont user my queue and instead do the resize/upload inside my model it will work.

0 likes
0 replies

Please or to participate in this conversation.