/** * Process the form. * * @return void */ public function save() { // attach the photo to the flyer $photo = $this->flyer->addPhoto($this->makePhoto()); // move the photo to the image folder $this->file->move($photo->baseDir(), $photo->name); // generate a thumbnail $this->thumbnail->make($photo->path, $photo->thumbnail_path); }
/** * Process the form. * * @return void */ public function save() { // attach the photo to the flyer // we call this addPhoto() method that the Flyer model already has // this method save and assigns the flyer_id in the process // and i need a photo so maybe i can extract a method here called makePhoto() $photo = $this->flyer->addPhoto($this->makePhoto()); // move the photo to the images folder $this->file->move($photo->baseDir(), $photo->name); // generate a thumbnail // Image::make($this->path) // ->fit(200) // ->save($this->thumbnail_path); // an easier way is to wrap this up within our own thumbnail class // then i could presumbably say the below and it will accept a source and a destination of where this should go // $this-thumbnail->make($src, $destination); $this->thumbnail->make($photo->path, $photo->thumbnail_path); }
/** * Process the form */ public function save() { $photo = $this->flyer->addPhoto($this->makePhoto()); $this->file->move($photo->baseDir(), $photo->name); $this->thumbnail->make($photo->path, $photo->thumbnail_path); }