Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 19th, 2010  |  syntax: PHP  |  size: 1.30 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }