public function save() { if (isset($_FILES[$this->table]) && $_FILES[$this->table]['size'][$this->file_column] > 0) { if ($this->{$this->file_column}) { $this->delete($this->id, true); } $this->{$this->file_column} = $_FILES[$this->table]; } if (is_array($this->{$this->file_column}) && isset($this->{$this->file_column}['tmp_name'])) { $this->handle_file($this->{$this->file_column}); $this->resize_image(); $new_id = parent::save(); $this->write_thumbs($new_id); return $new_id; } else { return parent::save(); } }