summaryrefslogtreecommitdiffstats
path: root/system/libraries/Image_lib.php
diff options
context:
space:
mode:
authorDevesa Agustín <devesagustserwi@est.frba.utn.edu.ar>2020-01-08 17:45:45 +0100
committerGitHub <noreply@github.com>2020-01-08 17:45:45 +0100
commitb8480e5edee881d06a4fded52598917bf509223c (patch)
treec4dfc4e241356cd218075140b4fc210b13c0e4b5 /system/libraries/Image_lib.php
parentce5815d9b3e99c99b75eace703e52d2b236b6392 (diff)
Update Image_lib.php
Diffstat (limited to 'system/libraries/Image_lib.php')
-rw-r--r--system/libraries/Image_lib.php52
1 files changed, 33 insertions, 19 deletions
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;
}