[eluser]Sein Kraft[/eluser]
Hi I'm new in codeigniter. First sorry about my english T_T.
I can't do work the creation of thumbnails. Anyone can help me?
Code:
<?php
class Upload extends Controller
{
function Upload()
{
parent::Controller();
$this->load->helper(array('form', 'url'));
}
function index()
{
$this->load->view('upload_form', array('error' => ' ' ));
}
function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2048'; //2 MB
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$config['image_library'] = 'GD2';
$config['source_image'] = './uploads/'.$upload_data['file_name'];
$config['maintain_ratio'] = TRUE;
$config['create_thumb'] = TRUE;
$config['height'] = '150';
$config['width'] = '150';
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->load->view('upload_success', $data);
}
}
}
?>