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

kendrick's avatar

Image source not readable (Upload Job Exception)

I am trying to handle uploads this way:

First upload the requested file locally, then trigger a UploadLogo Job to push the file to S3 and delete the local pathed-file.

I am always getting this exception:

Intervention\Image\Exception\NotReadableException: Image source not readable 
...

This is my setup:

UploadLogo.php (Job)

public $partner;
public $filename;
    

public function __construct($partner, $filename)
{
        $this->partner = $partner;
        $this->filename = $filename;
}

public function handle()
{
        $path = public_path() . '/uploads/partners/logos/' . $this->filename;
        $filename = $this->filename;

        if (Storage::disk('s3')->put('/uploads/partners/logos/'. $filename, fopen($path, 'r+'))) {
            File::delete($path);
        }
 
        $partner->logo_filename = $filename;
        $partner->save();
}

UploadController.php

public function uploadLogo(Request $request, Partner $partner){

//Validation...

if($request->hasFile('logo')){
    if ($request->file('logo')->isValid()) {
        $partner = Auth::user();

        $image = $request->file('logo');

        $filename = time() . '.' . $image->getClientOriginalExtension();
        $location = public_path('uploads/partners/logos/'. $filename);
        Image::make($image)->resize(300,300)->save($location);

        $partner->logo_filename = $filename;
        $partner->save();
                           
        $this->dispatch(new UploadLogo($partner, $filename));
    }

//Redirect with Info

}
}
0 likes
18 replies
kendrick's avatar

No, this won't work either. Same with uploading the file to storage_path...

rin4ik's avatar

please change this line and try

     $location = public_path('uploads/partners/logos/image.png');
kendrick's avatar

Also tried:

$partner->logo_filename = '/uploads/partners/logos/' . $filename;
rin4ik's avatar
Image::make($location)->resize(300,300)->save();

kendrick's avatar

This gives me Image source not readable as an Error page + failed Job.

rin4ik's avatar

if($request->hasFile('logo')){
    if ($request->file('logo')->isValid()) {
        $partner = Auth::user();

        $image = $request->file('logo'); 
        $location = public_path('uploads/partners/logos/');
        $request->file('logo')->move(location, $filename = uniqid(true));
        $this->dispatch(new UploadLogo($partner, $filename));
    }

//Redirect with Info
}
}
public function handle()
{
    
 $filename = $this->filename . '.png'
    $path = public_path() . '/uploads/partners/logos/' . $filename;
        Image::make($path)->encode('png')->fit(300,300, function ($c) {
            $c->upsize();
        })->save();
        if (Storage::disk('s3')->put('/uploads/partners/logos/'. $filename, fopen($path, 'r+'))) {
            File::delete($path);
        }
 
        $partner->logo_filename = $filename;
        $partner->save();
}
kendrick's avatar

Now we are getting: Call to a member function move() on null

So the problem is the location.

$request->file('image')->move($location);
rin4ik's avatar

sorry

  $request->file('logo')->move(location);
kendrick's avatar

The Upload Job fails again.

The image will be stored locally as a folder.

kendrick's avatar

The Job now only processes/ attempts once, but still not readable.

rin4ik's avatar

@splendidkeen you have this path in aws bucket please check /uploads/partners/logos/ . I reckon problem with path to bucket

Jatin's avatar

Try using chmod ( string $filename , int $mode ) function

1 like
kendrick's avatar

The folder structure is provided as /uploads/partners/logos/at aws. @rin4ik

Please or to participate in this conversation.