/** * Save content main picture * * @param null|File $file */ public function savePicture($file, $maxWidth = 1024) { if ($file) { $filename = 'picture.' . $file->getClientOriginalExtension(); $file->move(public_path($this->getStoragePath()), $filename); $this->seo_image = $filename; $this->save(); // Go resize if not empty if (!empty($maxWidth)) { $this->resizeImage(public_path($this->getStoragePath() . '/' . $filename), $maxWidth); } } }