diff options
author | Rick Ellis <rick.ellis@ellislab.com> | 2008-10-17 07:10:56 +0200 |
---|---|---|
committer | Rick Ellis <rick.ellis@ellislab.com> | 2008-10-17 07:10:56 +0200 |
commit | 457817d4ce790aa2614838b3fadfbf6de3b27c28 (patch) | |
tree | 5454f8fb8d38b295b728129a6815f278cf5db9b0 /system/libraries | |
parent | c2df89e7e7ff73d026d192ee16a548ed8725fd02 (diff) |
Fixed bug #4532. If cropping, but the new values are identical to the old values we simply save
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Image_lib.php | 41 |
1 files 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;
|