diff options
author | Andrey Andreev <narf@devilix.net> | 2016-12-14 12:05:05 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-12-14 12:05:05 +0100 |
commit | 867e8b56f752116fe1feae6c6db19020100458e3 (patch) | |
tree | 0b25fcb5cb6f2b9580db61dbe4e76e7ba6255536 /system/libraries/Image_lib.php | |
parent | 56d1efc5b14d7bd5a92800ba9394bf9201d48b61 (diff) | |
parent | 25aab832ff5b064166b5af4f5c4269407c56b338 (diff) |
Merge branch '3.1-stable' into develop
Diffstat (limited to 'system/libraries/Image_lib.php')
-rw-r--r-- | system/libraries/Image_lib.php | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 06cdde0b8..475649c46 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -544,37 +544,30 @@ 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; - } - // Is there a file name? - if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $full_dest_path)) + if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $this->new_image)) { - $this->dest_folder = $full_dest_path.'/'; - $this->dest_image = $this->source_image; + $this->dest_image = $this->source_image; + $this->dest_folder = $this->new_image; } else { - $x = explode('/', $full_dest_path); - $this->dest_image = end($x); - $this->dest_folder = str_replace($this->dest_image, '', $full_dest_path); + $x = explode('/', str_replace('\\', '/', $this->new_image)); + $this->dest_image = end($x); + $this->dest_folder = str_replace($this->dest_image, '', $this->new_image); } + + $this->dest_folder = realpath($this->dest_folder).'/'; } /* Compile the finalized filenames/paths |