[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Image resizing: Fix ValueError when Gd dimensions drop below 1px

"Bruno Kambere \(@kambereBr\) via TikiWiki-cvs" <[email protected]> Thu, 02 Jul 2026 15:12:02 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a467fc272d4_38199fec207a8@gitlab-sidekiq-low-urgency-cpu-bound-v2-76bc655848-q9zc5.mail>

Bruno Kambere pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
1e940832 by Aksanti Bahiga at 2026-07-02T17:52:09+03:00
[FIX] Image resizing: Fix ValueError when Gd dimensions drop below 1px
---
* [FIX] Image resizing: Fix ValueError when Gd dimensions drop below 1px

See merge request tikiwiki/tiki!10629

- - - - -


1 changed file:

- lib/Image/Gd.php


Changes:

=====================================
lib/Image/Gd.php
=====================================
@@ -113,6 +113,8 @@ class Gd extends ImageAbstract
                 $svgAttributes = ' width="' . $x . '" height="' . $y . '" viewBox="0 0 ' . $this->width . ' ' . $this->height . '" preserveAspectRatio="xMinYMin meet"';
                 $this->data = preg_replace('/width="' . $this->width . '" height="' . $this->height . '"/', $svgAttributes, $this->data);
             } else {
+                $x = max(1, (int) round($x));
+                $y = max(1, (int) round($y));
                 $t = imagecreatetruecolor($x, $y);
                 // trick #2 to have a transparent background for png instead of black
                 imagesavealpha($t, true);



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1e94083230c92c3edcf89ab80f58c8fa48754698

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1e94083230c92c3edcf89ab80f58c8fa48754698
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs