diff --git a/README.md b/README.md index f6c5c58..bed166d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ Image Extension for Mecha Release Notes ------------- +### 2.2.4 + + - Fix encoded data image URL being passed to the `imagecreatefromstring()` without decoding it first. + ### 2.2.3 - API has been reduced to only have an ability to resize and crop images. Other abilities such as flipping and rotating an image can be enabled in a separate extension. This extension is now focused to help authors in generating image thumbnails. diff --git a/image/about.page b/image/about.page index 9bd7d90..1bd874d 100644 --- a/image/about.page +++ b/image/about.page @@ -3,7 +3,7 @@ title: Image description: Image resizer and cropper. author: Taufik Nurrohman type: Markdown -version: 2.2.3 +version: 2.2.4 use: '.\lot\x\page': 0 diff --git a/image/engine/kernel/g-d.image.php b/image/engine/kernel/g-d.image.php index 35e5bd3..9719d73 100644 --- a/image/engine/kernel/g-d.image.php +++ b/image/engine/kernel/g-d.image.php @@ -75,7 +75,7 @@ public function __construct(string $path = null) { if (\is_string($path)) { // Create image from string if (0 === \strpos($path, 'data:image/') && false !== \strpos($path, ';base64,')) { - $blob = \imagecreatefromstring(\base64_decode(\explode(',', $path, 2)[1])); + $blob = \imagecreatefromstring(\base64_decode(\explode(',', $path = \urldecode($path), 2)[1])); $type = \substr(\explode(';', $path, 2)[0], 5); // Create image from remote URL } else if (false !== \strpos($path, '://') || 0 === \strpos($path, '/') && 0 !== \strpos($path, \ROOT)) {