diff options
author | Andrey Andreev <narf@devilix.net> | 2020-01-27 18:04:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 18:04:48 +0100 |
commit | 0fc185cbe1391e43e041ffa2453e3fa2f7a3905c (patch) | |
tree | a11bbacccb92c8fae54ef560b8e18c5f31466954 /system/libraries | |
parent | 0db8b60492cc98ef3c85b986fc11e9dac6d7ca6c (diff) | |
parent | a4fb657a156234127706bf44c24b310857c5990e (diff) |
[ci skip] Merge pull request #5883 from adevesa/image_lib-webp
image/webp for Image lib
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Image_lib.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 9cd0d1dfa..0d9fa4420 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -946,6 +946,10 @@ class CI_Image_lib { $cmd_in = 'pngtopnm'; $cmd_out = 'ppmtopng'; break; + case 18 : + $cmd_in = 'webptopnm'; + $cmd_out = 'ppmtowebp'; + break; } if ($action === 'crop') @@ -1470,6 +1474,13 @@ class CI_Image_lib { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; } + 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); default: @@ -1532,6 +1543,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; @@ -1573,6 +1597,8 @@ class CI_Image_lib { break; case 3 : imagepng($resource); break; + case 18 : imagewebp($resource); + break; default: echo 'Unable to display the image'; break; } |