Skip to content

Instantly share code, notes, and snippets.

@Tjoosten
Created December 12, 2014 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tjoosten/11aaff6a663c779e4abf to your computer and use it in GitHub Desktop.
Save Tjoosten/11aaff6a663c779e4abf to your computer and use it in GitHub Desktop.
if($this->Auth) {
$config['allowed_types'] = 'jpg';
$config['upload_path'] = './assets/Fotos';
$this->load->library('upload', $config);
if (!$this->upload->do_upload()) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
} else {
$Data = $this->upload->data();
// Image manipulation
$config['image_library'] = 'GD2';
$config['source_image'] = './assets/Fotos/'. $Data['file_name'];
$config['maintain_ratio'] = TRUE;
$config['height'] = 300;
$config['width'] = 100;
$config['quality'] = '100%';
$this->load->library('image_lib', $config);
if ( ! $this->image_lib->resize())
{
echo $this->image_lib->display_errors();
} else {
$this->Slachtoffer->InsertDB($Data);
redirect('Burger');
}
}
} else {
redirect('Burger','Refresh');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment