Im having a problem with codeigniter image resize. I upload the file as a zip file then unzip, after unzipping I scan the dir to look for a .jpg. if its a .jpg extension it needs to be resize. It works when the zip file has only one .jpg image but its not working when the zip file has 2 pr more .jpg image files.
It does scan all the jpg files problem is its not resizing.
I wanted to resize all the jpg files when I upload the zip file.
here is my code:
$images = scandir('uploads/new');
//print_r($images);
foreach($images as $image){
$last = substr($image, -3);
if($last == 'jpg'){
$image_path = './uploads/new/'.$image;
//$config['image_library'] = 'gd2';
$config['source_image'] = $image_path;
$config['maintain_ratio'] = TRUE;
$config['width'] = 100;
$config['height'] = 100;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
}
}