]> git.mxchange.org Git - friendica.git/commitdiff
Issue 14419: Avoid fatal errors with animated WebP images and GDlib
authorMichael <heluecht@pirati.ca>
Wed, 18 Sep 2024 04:06:57 +0000 (04:06 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 18 Sep 2024 04:06:57 +0000 (04:06 +0000)
src/Object/Image.php

index c971efc81af5c9e541d13243c5da442a920825e1..256de2f284597c30c08501b1647f90091ce2f7f0 100644 (file)
@@ -213,6 +213,12 @@ class Image
                }
 
                $this->valid = false;
+
+               if (($this->originType == IMAGETYPE_WEBP) && $this->isAnimatedWebP(substr($data, 0, 90))) {
+                       DI::logger()->notice('Animated WebP images are unsupported by GDlib. Please install Imagick.', ['file' => $this->filename]);
+                       return false;
+               }
+
                try {
                        $this->image = @imagecreatefromstring($data);
                        if ($this->image !== false) {