Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Upload_mod extends CI_Model{
- var $gallery_path;
- var $gallery_path_url;
- function index(){
- parent::__construct();
- $this->gallery_path = realpath(APPPATH . '../uploads');
- $this->gallery_path_url = base_url().'uploads/';
- }
- function do_upload() {
- $config = array(
- 'allowed_types' => 'jpg|jpeg|gif|png',
- 'upload_path' => $this->gallery_path);
- $this->load->library('upload');
- $this->upload->initialize($config);
- $this->upload->do_upload();
- $image_data = $this->upload->data();
- print_r($image_data);
- if ( ! $this->upload->do_upload())
- {
- $error = array('error' => $this->upload->display_errors());
- gd_info();
- echo $error;
- }
- $config['source_image'] = $image_data['full_path'];
- $config['new_image'] = $this->gallery_path . '/thumbs';
- $config['maintain_ratio'] = TRUE;
- $config['width'] = 75;
- $config['height'] = 50;
- $this->load->library('image_lib');
- $this->image_lib->initialize($config);
- $this->image_lib->resize();
- if ( ! $this->image_lib->resize())
- {
- echo $this->image_lib->display_errors();
- }
- }
- }
- $this->load->library('image_lib');
- $this->image_lib->initialize($config);
- // $this->image_lib->resize(); Remove this call to resize()
- if ( ! $this->image_lib->resize())
- {
- echo $this->image_lib->display_errors();
- }
- $this->load->library('image_lib');
- $this->image_lib->initialize($config);
- $success = $this->image_lib->resize();
- if ( ! $success)
- {
- echo $this->image_lib->display_errors();
- }
Add Comment
Please, Sign In to add comment