contact = $contact; } /** * Execute the job. * * @return void */ public function handle() { if ($this->contact->has_avatar == 'true') { $avatar_file = Storage::disk('public')->get($this->contact->avatar_file_name); $avatar_path = Storage::disk('public')->url($this->contact->avatar_file_name); $avatar_filename_without_extension = pathinfo($avatar_path, PATHINFO_FILENAME); $avatar_extension = pathinfo($avatar_path, PATHINFO_EXTENSION); $size = 110; $avatar_cropped_path = 'avatars/'.$avatar_filename_without_extension.'_'.$size.'.'.$avatar_extension; $avatar = Image::make($avatar_file); $avatar->fit($size); Storage::disk('public')->put($avatar_cropped_path, $avatar->stream()); $size = 174; $avatar_cropped_path = 'avatars/'.$avatar_filename_without_extension.'_'.$size.'.'.$avatar_extension; $avatar = Image::make($avatar_file); $avatar->fit($size); Storage::disk('public')->put($avatar_cropped_path, $avatar->stream()); } } }