Reputation: 3
I'm uploaded image to folder already .Right now i want to resize that image 3 times .First resize image to w:100,h:100,Second resize image to w:200,h:200 ,Third resize it to 300:300
Then I'm loaded library for Image Manipulation Class on top in function like this :: $this->load->library('image_lib');
this is my code
$picturesData[$key][$key2] = $this->upload->data(); <<< this upload library is usable
$file_name = $picturesData[$key][$key2]["file_name"];
//explode
$image_name = explode(".", $file_name);
//resize smallImage
$config['image_library'] = 'GD2';
$config['new_image'] = $path."/".$image_name[0]."_sSize";
// รูปที่เอามาใช้ในการ resize
$config['source_image'] = $picturesData[$key][$key2]["file_name"];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 100;
$config['height'] = 100;
//mediumSize
$config['new_image'] = $path."/".$image_name[0]."_mSize";
$config['width'] = 200;
$config['height'] = 200;
//largeSize
$config['new_image'] = $path."/".$image_name[0]."_lSize";
$config['width'] = 300;
$config['height'] = 300;
$this->image_lib->initialize($config);
$this->image_lib->resize();
if(! $this->image_lib->resize()){
echo $this->image_lib->display_errors();
}
this is my error !! The path to the image is not correct.
Your server does not support the GD function required to process this type of image.
The path to the image is not correct.
Your server does not support the GD function required to process this type of image.
The path to the image is not correct.
Your server does not support the GD function required to process this type of image.
Your server does not support the GD function required to process this type of image.
Upvotes: 0
Views: 3150
Reputation: 407
This seems like working for me. $config['source_image'] = './image path/pic_name.jpg';
Setup path to source .. exclude the base_url()
Upvotes: 1
Reputation: 51
continous Girish Sinha answer :: change this $config['source_image'] = $picturesData[$key][$key2]["file_name"]; to $config['source_image'] = $picturesData[$key][$key2]["full_path"];
Upvotes: 0
Reputation: 832
Try this:-
$picturesData[$key][$key2] = $this->upload->data(); //this upload library is usable
$file_name = $picturesData[$key][$key2]["file_name"];
//explode
$image_name = explode(".", $file_name);
//resize smallImage
$config['image_library'] = 'GD2';
$config['new_image'] = $path."/".$image_name[0]."_sSize.".$image_name[1];
//resize
$config['source_image'] = $picturesData[$key][$key2]["file_name"];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 100;
$config['height'] = 100;
$this->image_lib->initialize($config);
$this->image_lib->resize();
//mediumSize
$config['new_image'] = $path."/".$image_name[0]."_sSize.".$image_name[1];
$config['width'] = 200;
$config['height'] = 200;
$this->image_lib->initialize($config);
$this->image_lib->resize();
//largeSize
$config['new_image'] = $path."/".$image_name[0]."_sSize.".$image_name[1];
$config['width'] = 300;
$config['height'] = 300;
$this->image_lib->initialize($config);
$this->image_lib->resize();
Upvotes: 0