Problem With Image Resizing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: Problem With Image Resizing (/showthread.php?tid=69201) |
Problem With Image Resizing - waqaskhanbhatti - 10-18-2017 Hello to All Members, I have a problem in image resizing. I have a function name as do_resize(). it gets 4 parameters and return the name of the the new resized file. the code of this function is given below. PHP Code: public function do_resize($source_file, $target_folder, $height = 128, $width = 128) This function only work for one time. I'm calling this function from a loop to resize multiple images. the code of the loop is like this. PHP Code: foreach ($data['distributors'] as $key => $item){ I'm expecting from this code is that. When I starts the loop, at each attrition of the loop it takes the profile-image path and pass to the do_resize() function which will resize the image and store it in a target folder. But it works only for first attrition of the loop. and remaining profile-images are not resized. Any one can help me to solve this issue. Thanks RE: Problem With Image Resizing - InsiteFX - 10-19-2017 IF you look at your code you will see that you are over writing your foreach loop data $data['distributors'] RE: Problem With Image Resizing - waqaskhanbhatti - 10-19-2017 (10-19-2017, 03:28 AM)InsiteFX Wrote: IF you look at your code you will see that you are over writing your Yes I know, I'm overwriting the original data with the modified data. There is no problem in this overwriting. In fact I found the solution for this problem and that is written below. PHP Code: $this->image_lib->initialize($config_manip); Thanks for your reply. |