From 457817d4ce790aa2614838b3fadfbf6de3b27c28 Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Fri, 17 Oct 2008 05:10:56 +0000 Subject: Fixed bug #4532. If cropping, but the new values are identical to the old values we simply save --- system/libraries/Image_lib.php | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 6b1e7e704..8a6866753 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -448,18 +448,26 @@ class CI_Image_lib { function image_process_gd($action = 'resize') { $v2_override = FALSE; - - if ($action == 'crop') - { - // If the target width/height match the source then it's pointless to crop, right? - // So if dynamic output isn't on, then we'll return true so the user thinks - // the process succeeded. It'll be our little secret... - if ($this->width >= $this->orig_width AND $this->height >= $this->orig_height AND $this->dynamic_output !== TRUE) + // If the target width/height match the source, AND if the new file name is not equal to the old file name + // we'll simply make a copy of the original with the new name... assuming dynamic rendering is off. + if ($this->dynamic_output === FALSE) + { + if (($this->orig_width == $this->width AND $this->orig_height == $this->height) AND ($this->source_image != $this->new_image)) { + if ( ! @copy($this->full_src_path, $this->full_dst_path)) + { + $this->set_error('imglib_copy_failed'); + return FALSE; + } + + @chmod($this->full_dst_path, DIR_WRITE_MODE); return TRUE; } - + } + + if ($action == 'crop') + { // Reassign the source width/height if cropping $this->orig_width = $this->width; $this->orig_height = $this->height; @@ -472,22 +480,7 @@ class CI_Image_lib { } } else - { - // If the target width/height match the source, AND if - // the new file name is not equal to the old file name - // we'll simply make a copy of the original with the new name - if (($this->orig_width == $this->width AND $this->orig_height == $this->height) AND ($this->source_image != $this->new_image)) - { - if ( ! @copy($this->full_src_path, $this->full_dst_path)) - { - $this->set_error('imglib_copy_failed'); - return FALSE; - } - - @chmod($this->full_dst_path, DIR_WRITE_MODE); - return TRUE; - } - + { // If resizing the x/y axis must be zero $this->x_axis = 0; $this->y_axis = 0; -- cgit v1.2.3-24-g4f1b