diff options
author | Andrey Andreev <narf@devilix.net> | 2016-12-09 11:48:57 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-12-09 11:48:57 +0100 |
commit | 961271dc3d02d7b2f71847983c8e5a03ca003582 (patch) | |
tree | 7db1c28965f28058ccd58aff394ee0ce6457a6cf /system/libraries | |
parent | 2eee8705dee6f3d9f12d0826f13d31bac8b4dcd5 (diff) |
[ci skip] Fix #4937
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Image_lib.php | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 06cdde0b8..39a30f0f5 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -544,35 +544,28 @@ class CI_Image_lib { */ if ($this->new_image === '') { - $this->dest_image = $this->source_image; + $this->dest_image = $this->source_image; $this->dest_folder = $this->source_folder; } - elseif (strpos($this->new_image, '/') === FALSE) + elseif (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE) { + $this->dest_image = $this->new_image; $this->dest_folder = $this->source_folder; - $this->dest_image = $this->new_image; } else { - if (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE) - { - $full_dest_path = str_replace('\\', '/', realpath($this->new_image)); - } - else - { - $full_dest_path = $this->new_image; - } + $full_dest_path = str_replace('\\', '/', realpath($this->new_image)); // Is there a file name? if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $full_dest_path)) { + $this->dest_image = $this->source_image; $this->dest_folder = $full_dest_path.'/'; - $this->dest_image = $this->source_image; } else { $x = explode('/', $full_dest_path); - $this->dest_image = end($x); + $this->dest_image = end($x); $this->dest_folder = str_replace($this->dest_image, '', $full_dest_path); } } |