<?php
class Gallery extends Controller {
var $gallery_path;
var $gallery_path_url;
function index() {
$this->load->model('Gallery_model');
if ($this->input->post('upload')) {
$this->gallery_path = realpath(APPPATH . '../assets/images/gallery');
$this->gallery_path_url = base_url().'assets/images/gallery/';
$config = array(
'allowed_types' => 'jpg|jpeg|gif|png',
'upload_path' => $this->gallery_path,
'max_size' => 2000
);
$this->load->library('upload', $config);
$this->upload->do_upload();
$image_data = $this->upload->data();
$config = array(
'source_image' => $image_data['full_path'],
'new_image' => $this->gallery_path . '/thumbs',
'maintain_ration' => true,
'width' => 150,
'height' => 100
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
}
$data['gallery_path'] = realpath(APPPATH . '../assets/images/gallery');
$data['gallery_path_url'] = base_url().'assets/images/gallery/';
$data['images'] = $this->Gallery_model->get_images();
$data['page_title'] = 'Verde Valley Business Resource - Gallery Manager';
$data['page'] = '/ads/gallery_view'; // pass the actual view to use as a parameter
$this->load->view('container',$data);
}
}