Hi Team,
I am using GD Image Library for resizing the image.
Uploading image to folder is working but resize image code is showing me the error
Your server does not support the GD function required to process this type of image.
Here is my code
$config['upload_path'] = $file_path;
$config['allowed_types'] = 'gif|jpg|png';
// $config['max_size'] = 1000000;
// print_r($config);exit;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload('image_name'))
{
$error = array('error' => $this->upload->display_errors());
// print_r($error);exit;
}
else
{
$data = array('upload_data' => $this->upload->data());
$zfile = $data['upload_data']['full_path']; // get file path
chmod($zfile,0777); // CHMOD file
$img_config['image_library'] = 'gd2';
$img_config['source_image'] = $data['upload_data']['full_path'];
$img_config['create_thumb'] = TRUE;
$img_config['maintain_ratio'] = TRUE;
$img_config['quality'] = '60%';
$img_config['width'] = 150;
$img_config['height'] = 75;
$img_config['new_image'] = $_SERVER['DOCUMENT_ROOT'].'/public/order_new_img/';
// $this->resize($file_path,$data['upload_data']['file_name']);
$size = filesize($data['upload_data']['full_path']);
// pre($config);
// var_dump(gd_info());
$this->load->library('image_lib');
$this->image_lib->clear();
$this->image_lib->initialize($img_config);
$this->image_lib->resize();
// pre(getimagesize($data['upload_data']['full_path']));
if (!$this->image_lib->resize()){
echo $this->image_lib->display_errors();exit;
} else {
echo "done";exit;
}
Attached Files
Thumbnail(s)