Advertisement
Guest User

Untitled

a guest
Jul 19th, 2010
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.30 KB | None | 0 0
  1. <?php
  2. class Gallery extends Controller {
  3.    
  4.     var $gallery_path;
  5.     var $gallery_path_url;
  6.    
  7.    
  8.     function index() {
  9.        
  10.         $this->load->model('Gallery_model');
  11.        
  12.         if ($this->input->post('upload')) {
  13.        
  14.             $this->gallery_path = realpath(APPPATH . '../assets/images/gallery');
  15.             $this->gallery_path_url = base_url().'assets/images/gallery/';
  16.  
  17.             $config = array(
  18.                 'allowed_types' => 'jpg|jpeg|gif|png',
  19.                 'upload_path' => $this->gallery_path,
  20.                 'max_size' => 2000
  21.             );
  22.  
  23.             $this->load->library('upload', $config);
  24.             $this->upload->do_upload();
  25.             $image_data = $this->upload->data();
  26.  
  27.             $config = array(
  28.                 'source_image' => $image_data['full_path'],
  29.                 'new_image' => $this->gallery_path . '/thumbs',
  30.                 'maintain_ration' => true,
  31.                 'width' => 150,
  32.                 'height' => 100
  33.             );
  34.  
  35.             $this->load->library('image_lib', $config);
  36.             $this->image_lib->resize();
  37.         }
  38.        
  39.         $data['gallery_path'] = realpath(APPPATH . '../assets/images/gallery');
  40.         $data['gallery_path_url'] = base_url().'assets/images/gallery/';
  41.        
  42.         $data['images'] = $this->Gallery_model->get_images();
  43.         $data['page_title'] = 'Verde Valley Business Resource - Gallery Manager';
  44.         $data['page'] = '/ads/gallery_view'; // pass the actual view to use as a parameter
  45.         $this->load->view('container',$data);
  46.        
  47.     }
  48.  
  49.    
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement