/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$config['upload_path'] = ‘./upload/banner/’; $config['allowed_types'] = ‘jpg’; $config['max_size'] = ’200000′; $config['max_width'] = ’1524′; $config['max_height'] = ’1000′; $this->load->library(‘upload’, $config); $this->load->library(‘image_lib’); if ( ! $this->upload->do_upload()) { $data['product_brand']= $this->admin_ads_model->mng_brand(); $this->load->view(‘admin_view/add_product_pack’, $error); } else { $image= $data1['upload_data']['file_name']; $configBig['image_library'] = ‘gd2′; $configBig['source_image'] = ‘./upload/banner/’.$image; $configBig['create_thumb'] = TRUE; $configBig['maintain_ratio'] = FALSE; $configBig['width'] = 200; $configBig['height'] = 200; $configBig['thumb_marker'] = “_bigâ€; $this->image_lib->initialize($configBig); $this->image_lib->resize(); $this->image_lib->clear(); $configBig['image_library'] = ‘gd2′; $configBig['source_image'] = ‘./upload/banner/’.$image; $configBig['create_thumb'] = TRUE; $configBig['maintain_ratio'] = FALSE; $configBig['width'] = 100; $configBig['height'] = 100; $configBig['thumb_marker'] = “_thumbâ€; $this->image_lib->initialize($configBig); $this->image_lib->resize(); $this->image_lib->clear(); $filename1 = $data1['upload_data']['raw_name'].’_big’.$data1['upload_data']['file_ext']; $filename2 = $data1['upload_data']['raw_name'].’_thumb’.$data1['upload_data']['file_ext']; }