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

trainman001's avatar

Getting Error: NotReadableException in AbstractDecoder.php line 302

Hi All,

I am getting the following error when following Jeffrey Way's video on creating thumbnails within Project Flyer series (link below). Error: NotReadableException in AbstractDecoder.php line 302: Image source not readable

The error happens when i drop the photos in drop photos in drop zone. The original photo is stored in my flyers/photo folder, but the thumbnail file is never created and the photo is not stored in the database. I have followed all the steps and checked the routes, models, views controllers but everything seems to be identical to the tutorial so I am not sure what I am doing wrong. I believe something is wrong with the makeThumbnail function within Photo.php. The error stops showing up if I dd() this function, but I have failed at fixing it after many attempts.

Any suggestions? https://laracasts.com/series/build-project-flyer-with-me/episodes/13

namespace App;

use Intervention\Image\Facades\Image; use Illuminate\Database\Eloquent\Model; use Symfony\Component\HttpFoundation\File\UploadedFile;

class Photo extends Model { protected $table = 'flyer_photos'; protected $fillable = ['path' , 'name' , 'thumbnail_path']; protected $baseDir = 'flyer/photos';

public function flyer(){
    // creates a new instance of a photo
    return $this->belongsTo('App\Flyer');
}

/**
 * Build a photo instance from a file upload
 */
public static function named($name){
   return (new static)->saveAs($name);

}

/**
 * Setting name, path, and thumbnail_path parameters for Photo instance
 */
protected function saveAs($name){
    //concatenate file name with current time to prevent duplicate entries in db
    $this->name = sprintf("%s-%s", time(), $name);
    $this->path = sprintf("%/%s", $this->baseDir, $this->name);
    $this->thumbnail_path =sprintf("%s/tn-%s", $this->baseDir, $this->name);
    return $this;

}

public function move(UploadedFile $file){
    // move the file to new location in flyer/photos
    $file->move($this->baseDir, $this->name);
    $this->makeThumbnail();
    return $this;

}

/**
 * Change sizing of thumbnail and save it
 */
protected function makeThumbnail() {
    //dd('error test');
    Image::make($this->path)
    ->fit(200)
    ->save($this->thumbnail_path);
}

}

0 likes
4 replies
trainman001's avatar

Anyone have any ideas? I have run out of ideas to fix it at this point.

thomaskim's avatar

I posted this earlier on stackoverflow, but it looks like you have an error on this line:

$this->path = sprintf("%/%s", $this->baseDir, $this->name);

It should be:

$this->path = sprintf("%s/%s", $this->baseDir, $this->name);
stefkay's avatar

Was a solution found to this error? I have the same problem, hmmmmm.

Please or to participate in this conversation.