I have a problem resizing the code. I download the file as a zip file, and then unpack it, after unpacking I scan the directory to find .jpg. if its extension .jpg needs to be resized. It works when the zip file has only one .jpg image, but it does not work when the zip file has 2 files larger than .jpg images.
Scanning all jpg files is not a resize.
I want to resize all jpg files when downloading a 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(); } }
source share