Skip to content

Instantly share code, notes, and snippets.

@azamuddin
Last active August 29, 2015 14:11
Show Gist options
  • Save azamuddin/564cc34c966909a2ea48 to your computer and use it in GitHub Desktop.
Save azamuddin/564cc34c966909a2ea48 to your computer and use it in GitHub Desktop.
uploadFile method
/**
* @return update field name
*/
protected function uploadFile($filename, $safe = false)
{
// don't need to upload the file because we want to save it on database as long blob
// if ($safe) {
// try {
// $this->file->move($this->path, $filename);
// $this->saved = $this->path. $filename;
// } catch (Exception $e) {
// }
// } else {
// $this->file->move($this->path, $filename);
// $this->saved = $this->path. $filename;
// }
//\Event::fire('rapyd.uploaded.'.$this->name);
return true;
}
/**
* @return update field name
*/
protected function updateName($save)
{
$the_image = ImageManager::make(Input::file($this->name)->getRealPath())->resize('200');
$the_image = $the_image->encode('data-url');
if (isset($this->new_value)) {
//$this->model->setAttribute($this->db_name, $this->new_value);
$this->model->setAttribute($this->db_name, $the_image);
} else {
//$this->model->setAttribute($this->db_name, $this->value);
$this->model->setAttribute($this->db_name, $the_image);
}
if ($save) {
return $this->model->save();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment