![]() |
crop() does nothing when cropping 100% - 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: crop() does nothing when cropping 100% (/showthread.php?tid=7380) |
crop() does nothing when cropping 100% - El Forum - 04-06-2008 [eluser]splufdaddy[/eluser] I have an interface that allows users to set a crop area on an image. If they select the whole image, the crop() function doesn't do anything. This is a problem for me because my crop function is set up to perform the crop and save it as a new image, and the new image is not made. I noticed that a change was made to Image_lib.php from 1.5.4 to 1.6.1 . This code: Code: // If the target width/height match the source then it's pointless to crop, right? was changed to this: Code: // If the target width/height match the source then it's pointless to crop, right? My workaround right now is to copy the original file to the new destination, and then perform the crop. If a crop happens, then the new file is overwritten. If the user selected 100% to crop, then the crop() does nothing, but the image has already been moved. crop() does nothing when cropping 100% - El Forum - 04-08-2008 [eluser]splufdaddy[/eluser] Any thoughts on this? I'd love to be able to rely on crop to move my image to a new location, even if the crop is set to 100% of the image. crop() does nothing when cropping 100% - El Forum - 04-13-2008 [eluser]splufdaddy[/eluser] Sorry for the second bump, but I'd love to get my change incorporated into CI. I changed line 460 of Image_lib.php from this: Code: if ($this->width >= $this->orig_width AND $this->height >= $this->orig_height AND $this->dynamic_output !== TRUE) Code: if ($this->width >= $this->orig_width AND $this->height >= $this->orig_height AND $this->dynamic_output !== TRUE AND $this->full_src_path == $this->full_dst_path) and crop works. I'm not sure if you'll want to add some additional logic, because now if we're trying to crop an image to a new location and the crop width or height is larger than the original width or height, the crop will continue. |