From 1be0f05e3f70a369e9e3e5153d0f786c0d2dface Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Fri, 12 Feb 2016 22:31:15 +0100 Subject: return false when image isn't valid --- system/libraries/Image_lib.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index f594b7125..e3e87f93f 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1641,6 +1641,11 @@ class CI_Image_lib { } $vals = getimagesize($path); + if ($vals === FALSE) + { + $this->set_error('imglib_invalid_image'); + return FALSE; + } $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); $mime = (isset($types[$vals[2]])) ? 'image/'.$types[$vals[2]] : 'image/jpg'; -- cgit v1.2.3-24-g4f1b From 62adbbd6cb2bc56258817efbc8f201250de6b64d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 16 Dec 2016 15:48:14 +0200 Subject: [ci skip] Remove a function_exists() call from CI_Image_lib We use this function elsewhere without checking for existence; nobody has complained --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 475649c46..884d0dcec 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1194,7 +1194,7 @@ class CI_Image_lib { } // Build the finalized image - if ($wm_img_type === 3 && function_exists('imagealphablending')) + if ($wm_img_type === 3) { @imagealphablending($src_img, TRUE); } -- cgit v1.2.3-24-g4f1b From fced25f5728ce81fe810216fcaa4ccec7523f6c9 Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/libraries/Image_lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 884d0dcec..0685692de 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 208381009ed12768478b2e8110bfb6e506acc3e1 Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Tue, 9 Jan 2018 00:53:27 -0800 Subject: Annual copyright update --- system/libraries/Image_lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 60ed05766..63e071e7c 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 2ad0b3553121ea2e5951179ac0aaca8fc71b767b Mon Sep 17 00:00:00 2001 From: Mehdi Bounya <5004111+mehdibo@users.noreply.github.com> Date: Wed, 31 Jan 2018 04:43:37 +0000 Subject: File name changing in dynamic output Allow changing file name (`Content-Disposition` header) when outputting the image by specifying the `new_name` config --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 63e071e7c..f7b66c72e 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1548,7 +1548,7 @@ class CI_Image_lib { */ public function image_display_gd($resource) { - header('Content-Disposition: filename='.$this->source_image.';'); + header('Content-Disposition: filename='.( (empty($this->new_image)) ? $this->source_image : $this->new_image ).';'); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); -- cgit v1.2.3-24-g4f1b From 10cc80e9f35aac497fe5b60b3e409a213a5a5291 Mon Sep 17 00:00:00 2001 From: Mehdi Bounya <5004111+mehdibo@users.noreply.github.com> Date: Wed, 31 Jan 2018 22:44:16 +0000 Subject: Update Image_lib.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I didn't understand #5394 that well, what I understood from your comment is that we should convert the charset to UTF-8. I tested with **マルチバイト** but it outputs nothing (empty string), but when I add a character **before** the string (e.g. xマルチバイト) it worked fine. --- system/libraries/Image_lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index f7b66c72e..b5e86f8a7 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1548,7 +1548,8 @@ class CI_Image_lib { */ public function image_display_gd($resource) { - header('Content-Disposition: filename='.( (empty($this->new_image)) ? $this->source_image : $this->new_image ).';'); + $filename = basename(empty($this->new_image) ? $this->source_image : $this->new_image); + header('Content-Disposition: filename='.$filename.'; filename*=UTF-8\'\''.rawurlencode(iconv(config_item('charset'), 'UTF-8', $filename))); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); -- cgit v1.2.3-24-g4f1b From d4fbb65b9a5c75b00ad8374021c72eb6ff4a58df Mon Sep 17 00:00:00 2001 From: Mehdi Bounya <5004111+mehdibo@users.noreply.github.com> Date: Wed, 7 Feb 2018 18:48:17 +0000 Subject: Changing file name in image lib dynamic output --- system/libraries/Image_lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index b5e86f8a7..0c36f740c 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1548,8 +1548,7 @@ class CI_Image_lib { */ public function image_display_gd($resource) { - $filename = basename(empty($this->new_image) ? $this->source_image : $this->new_image); - header('Content-Disposition: filename='.$filename.'; filename*=UTF-8\'\''.rawurlencode(iconv(config_item('charset'), 'UTF-8', $filename))); + header('Content-Disposition: filename='.basename(empty($this->new_image) ? $this->source_image : $this->new_image).';'); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); -- cgit v1.2.3-24-g4f1b From 06e5d36f566c68b51ded2c2c307094c062e17a10 Mon Sep 17 00:00:00 2001 From: Mehdi Bounya <5004111+mehdibo@users.noreply.github.com> Date: Mon, 12 Feb 2018 19:15:01 +0000 Subject: Update Image_lib.php Fixed indentation --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 0c36f740c..f37f25f5e 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1548,7 +1548,7 @@ class CI_Image_lib { */ public function image_display_gd($resource) { - header('Content-Disposition: filename='.basename(empty($this->new_image) ? $this->source_image : $this->new_image).';'); + header('Content-Disposition: filename='.basename(empty($this->new_image) ? $this->source_image : $this->new_image).';'); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); -- cgit v1.2.3-24-g4f1b From 2e35167e8e8be5c91de2a09dcebb92e7a7410d8d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 14 Feb 2018 20:57:20 +0200 Subject: [ci skip] Apply #5394 (multibyte filename serving) to #5397 (Image_lib dynamic_output filename) --- system/libraries/Image_lib.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index f37f25f5e..dbe5cbbd1 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1548,7 +1548,16 @@ class CI_Image_lib { */ public function image_display_gd($resource) { - header('Content-Disposition: filename='.basename(empty($this->new_image) ? $this->source_image : $this->new_image).';'); + // RFC 6266 allows for multibyte filenames, but only in UTF-8, + // so we have to make it conditional ... + $filename = basename(empty($this->new_image) ? $this->source_image : $this->new_image); + $charset = strtoupper(config_item('charset')); + $utf8_filename = ($charset !== 'UTF-8') + ? get_instance()->utf8->convert_to_utf8($filename, $charset) + : $filename; + isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); + + header('Content-Disposition: filename="'.$filename.'";'.$utf8_filename); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); -- cgit v1.2.3-24-g4f1b From 6f7f5f403769544e7e2dd7f6b0056920768236fb Mon Sep 17 00:00:00 2001 From: xims Date: Thu, 8 Mar 2018 18:04:48 +1100 Subject: Update Image_lib to avoid setting file permissions when not needed When processing an image, there is no need to set file permissions when using dynamic_output. In some cases, it floods the log file with errors ERROR --> Severity: Warning --> chmod(): Operation not permitted ...../CodeIgniter/libraries/Image_lib.php 838 --- system/libraries/Image_lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index dbe5cbbd1..a07557f61 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -835,7 +835,10 @@ class CI_Image_lib { imagedestroy($dst_img); imagedestroy($src_img); - chmod($this->full_dst_path, $this->file_permissions); + if ($this->dynamic_output !== TRUE) + { + chmod($this->full_dst_path, $this->file_permissions); + } return TRUE; } -- cgit v1.2.3-24-g4f1b From 52a87e506d4fc70bd5922b07a532852d28f28ab6 Mon Sep 17 00:00:00 2001 From: Mehdi Bounya Date: Thu, 17 May 2018 23:41:30 +0000 Subject: http:// to https:// --- system/libraries/Image_lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index a07557f61..a41cd8850 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource -- cgit v1.2.3-24-g4f1b From 8bb638e392f5991c05ec9a1e57b882213844dc6f Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Wed, 26 Dec 2018 21:03:09 -0800 Subject: Update copyright date to 2019 --- system/libraries/Image_lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index a41cd8850..9cd0d1dfa 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From b8480e5edee881d06a4fded52598917bf509223c Mon Sep 17 00:00:00 2001 From: Devesa Agustín Date: Wed, 8 Jan 2020 13:45:45 -0300 Subject: Update Image_lib.php --- system/libraries/Image_lib.php | 52 +++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 9cd0d1dfa..b595d0f63 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2019, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) - * @license https://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource @@ -835,10 +835,7 @@ class CI_Image_lib { imagedestroy($dst_img); imagedestroy($src_img); - if ($this->dynamic_output !== TRUE) - { - chmod($this->full_dst_path, $this->file_permissions); - } + chmod($this->full_dst_path, $this->file_permissions); return TRUE; } @@ -946,6 +943,10 @@ class CI_Image_lib { $cmd_in = 'pngtopnm'; $cmd_out = 'ppmtopng'; break; + case 18 : + $cmd_in = 'webptopnm'; + $cmd_out = 'ppmtowebp'; + break; } if ($action === 'crop') @@ -975,7 +976,7 @@ class CI_Image_lib { $cmd_inner = 'pnmscale -xysize '.$this->width.' '.$this->height; } - $cmd = $this->library_path.$cmd_in.' '.escapeshellarg($this->full_src_path).' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp'; + $cmd = $this->library_path.$cmd_in.' '.$this->full_src_path.' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp'; $retval = 1; // exec() might be disabled @@ -1207,7 +1208,7 @@ class CI_Image_lib { } // Build the finalized image - if ($wm_img_type === 3) + if ($wm_img_type === 3 && function_exists('imagealphablending')) { @imagealphablending($src_img, TRUE); } @@ -1472,6 +1473,13 @@ class CI_Image_lib { } return imagecreatefrompng($path); + case 18: + if ( ! function_exists('imagecreatefromwebp')) + { + $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported')); + return FALSE; + } + return imagecreatefromwebp($path); default: $this->set_error(array('imglib_unsupported_imagecreate')); return FALSE; @@ -1532,6 +1540,19 @@ class CI_Image_lib { return FALSE; } break; + case 18: + if ( ! function_exists('imagewebp')) + { + $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported')); + return FALSE; + } + + if ( ! @imagewebp($resource, $this->full_dst_path)) + { + $this->set_error('imglib_save_failed'); + return FALSE; + } + break; default: $this->set_error(array('imglib_unsupported_imagecreate')); return FALSE; @@ -1551,16 +1572,7 @@ class CI_Image_lib { */ public function image_display_gd($resource) { - // RFC 6266 allows for multibyte filenames, but only in UTF-8, - // so we have to make it conditional ... - $filename = basename(empty($this->new_image) ? $this->source_image : $this->new_image); - $charset = strtoupper(config_item('charset')); - $utf8_filename = ($charset !== 'UTF-8') - ? get_instance()->utf8->convert_to_utf8($filename, $charset) - : $filename; - isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); - - header('Content-Disposition: filename="'.$filename.'";'.$utf8_filename); + header('Content-Disposition: filename='.$this->source_image.';'); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); @@ -1573,6 +1585,8 @@ class CI_Image_lib { break; case 3 : imagepng($resource); break; + case 18 : imagewebp($resource); + break; default: echo 'Unable to display the image'; break; } -- cgit v1.2.3-24-g4f1b From 5e0cfd96233b84478682053aed29c38e24774a0e Mon Sep 17 00:00:00 2001 From: Devesa Agustín Date: Wed, 8 Jan 2020 14:04:14 -0300 Subject: Update Image_lib.php --- system/libraries/Image_lib.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index b595d0f63..0d9fa4420 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource @@ -835,7 +835,10 @@ class CI_Image_lib { imagedestroy($dst_img); imagedestroy($src_img); - chmod($this->full_dst_path, $this->file_permissions); + if ($this->dynamic_output !== TRUE) + { + chmod($this->full_dst_path, $this->file_permissions); + } return TRUE; } @@ -976,7 +979,7 @@ class CI_Image_lib { $cmd_inner = 'pnmscale -xysize '.$this->width.' '.$this->height; } - $cmd = $this->library_path.$cmd_in.' '.$this->full_src_path.' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp'; + $cmd = $this->library_path.$cmd_in.' '.escapeshellarg($this->full_src_path).' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp'; $retval = 1; // exec() might be disabled @@ -1208,7 +1211,7 @@ class CI_Image_lib { } // Build the finalized image - if ($wm_img_type === 3 && function_exists('imagealphablending')) + if ($wm_img_type === 3) { @imagealphablending($src_img, TRUE); } @@ -1471,8 +1474,6 @@ class CI_Image_lib { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; } - - return imagecreatefrompng($path); case 18: if ( ! function_exists('imagecreatefromwebp')) { @@ -1480,6 +1481,8 @@ class CI_Image_lib { return FALSE; } return imagecreatefromwebp($path); + + return imagecreatefrompng($path); default: $this->set_error(array('imglib_unsupported_imagecreate')); return FALSE; @@ -1572,7 +1575,16 @@ class CI_Image_lib { */ public function image_display_gd($resource) { - header('Content-Disposition: filename='.$this->source_image.';'); + // RFC 6266 allows for multibyte filenames, but only in UTF-8, + // so we have to make it conditional ... + $filename = basename(empty($this->new_image) ? $this->source_image : $this->new_image); + $charset = strtoupper(config_item('charset')); + $utf8_filename = ($charset !== 'UTF-8') + ? get_instance()->utf8->convert_to_utf8($filename, $charset) + : $filename; + isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); + + header('Content-Disposition: filename="'.$filename.'";'.$utf8_filename); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); -- cgit v1.2.3-24-g4f1b From 5abd2ae8c7fb30585dae2bf96ffa847771ebad7f Mon Sep 17 00:00:00 2001 From: Diego Date: Thu, 2 Apr 2020 12:51:32 +0200 Subject: Fixed issue with creating a resource from png using Image_lib --- system/libraries/Image_lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 0d9fa4420..0ef76a101 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1474,15 +1474,16 @@ class CI_Image_lib { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; } + + return imagecreatefrompng($path); case 18: if ( ! function_exists('imagecreatefromwebp')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported')); return FALSE; } - return imagecreatefromwebp($path); - return imagecreatefrompng($path); + return imagecreatefromwebp($path); default: $this->set_error(array('imglib_unsupported_imagecreate')); return FALSE; -- cgit v1.2.3-24-g4f1b From 6ba0207160f8f2b99c79dd285bccf45f574ec660 Mon Sep 17 00:00:00 2001 From: sapics Date: Wed, 24 Jun 2020 11:51:36 +0900 Subject: Fix user guide url Replace from https://codeigniter.com/user_guide/* to https://codeigniter.com/userguide3/* --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Image_lib.php') diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 0ef76a101..6aeee1790 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Libraries * @category Image_lib * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/libraries/image_lib.html + * @link https://codeigniter.com/userguide3/libraries/image_lib.html */ class CI_Image_lib { -- cgit v1.2.3-24-g4f1b