I want upload image with fixed size in codeigniter.But my code is not working.Anyone please help me for doing this..My code is
public function createevent() {
if ($this->input->post('submit')) {
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_width'] = '366';
$config['max_height'] = '269';
$this->load->library('upload', $config);
// $data = array('upload_data' => $this->upload->data());
$data = $this->upload->data();
$logo = $data['file_name'];
$fileInfo = getimagesize($data);
if( $fileInfo['width'] == 366 && $fileInfo['height'] == 269 ) {
// if(($fileInfo[0] == 366) && ($fileInfo[1] == 269 )){
// if ($this->upload->do_upload()) {
$this->event_model->createevent( $logo);
$this->session->set_flashdata('msg', 'Event Created');
} else {
// $this->image_lib->resize();
$this->session->set_flashdata('error', 'Please upload image within the size limit');
redirect('event/events');
}
}
}