![]() |
Image Manipulation Lib: Resize and Crop on multiple files - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Image Manipulation Lib: Resize and Crop on multiple files (/showthread.php?tid=48764) |
Image Manipulation Lib: Resize and Crop on multiple files - El Forum - 01-27-2012 [eluser]Unknown[/eluser] Hi guys, I've had a problem with this class, and just found a solution, but theres a bug somewhere IMHO. When resizing and then cropping multiple image, I got a bunch of errors about file not found. When doing it one by one it worked. First resizing all of the images, and then cropping them worked as well. When I changed the create_thumb to FALSE and new_image to image location it works like a charm This is the oryginal message that I posted here: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - I'm struggling to get the CodeIgniter Image Manipulation working correctly. Either it's a bug or I'm just not seeing it. I hope someone can help me with it. Thanks in advance! On the script: I want to create thumbnails (176w x 132h). The input images are in different sizes and ratios. In order to always get this size I first resize them to fit the max width or height (depending on image orientation) and then crop in the center. I've tried to do it all in 1 method. That didn't work, so I created two seperate methods. resize_img() and crop_img(). When I run resize_img() on 3 different files, it works. If after that I use crop_img() on these thumbnails the 1th method created, it works. If I combine the two, or use them after one another, it doesn't. I've tried $this->image_lib->clear();, unsetting the config files. I even created two config files, just to be sure. I'm getting different all kind of errors from GD2, but the problem is, that after resize_img() creates the thumbnail, the crop_img() won't crop it. After that it all goes south, and the next images can't be opened. Write premissions are checked, both on folder and files. Unable to save the image. Please make sure the image and file directory are writable. The path to the image is not correct. Your server does not support the GD function required to process this type of image. Full code: Code: <?PHP The solution: Code: $config['create_thumb'] = FALSE; |