Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. public function _do_upload_file()
  2.     {  
  3.         //upload config
  4.         $config = array(
  5.             'allowed_types' => '*', //jpg|jpeg|gif|png|pdf|JPEG|PNG|JPG|GIF|tiff|PDF
  6.             'upload_path'   => $gallery_path,
  7.             'max_size'      => 30000, //30MB limit
  8.             'overwrite'     => false, //Doesnt overwrite exsisting
  9.             'remove_spaces' => true, // Removes any white space
  10.             'encrypt_name'  => true // Encrypt file name
  11.         );
  12.        
  13.         $this->load->library('upload', $config);
  14.         $this->upload->initialize($config);  
  15.          
  16.        
  17.         if (!$this->upload->do_upload())
  18.         {
  19.             $this->form_validation->set_message('_do_upload_file', $this->upload->display_errors());
  20.             return FALSE;
  21.         }
  22.         else
  23.         {
  24.         // Resize Config
  25.             $config['image_library'] = 'gd2';
  26.             $config['source_image'] = $this->upload->upload_path.$this->upload->file_name;
  27.             $config['new_image'] = $gallery_path . '/thumbs';
  28.             $config['maintain_ratio'] = TRUE;
  29.             $config['width'] = 137;
  30.             $config['quality'] = '90%';
  31.             $config['height'] = 118;
  32.            
  33.             /* echo $this->upload->upload_path.$this->upload->file_name . "<BR>";  */
  34.            
  35.             $this->load->library('image_lib', $config);
  36.             $this->image_lib->initialize($config);
  37.             $this->image_lib->resize();
  38.                  
  39.             if (!$this->image_lib->resize()){
  40.                    $this->form_validation->set_message('_do_upload_file', $this->upload->display_errors());              
  41.             }
  42.            
  43.            
  44.         }
  45.  
  46.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement