Bug #79676 [Asn->Ver]: imagescale adds black border with IMG_BICUBIC

From: Date: Fri, 05 Jun 2020 14:51:03 +0000
Subject: Bug #79676 [Asn->Ver]: imagescale adds black border with IMG_BICUBIC
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227329@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79676&edit=1 ID: 79676 Updated by: cmb@php.net Reported by: rubik99 at pokemail dot net Summary: imagescale adds black border with IMG_BICUBIC -Status: Assigned +Status: Verified Type: Bug Package: GD related Operating System: Irrelevant PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: > I was unsure if php_gd2.dll included in Windows versions is a > PHP-specific dll or just a very old official GD dll. That is the PHP GD extension which also includes the bundled libgd. > Also confused why PHP bundles old GD version with known security > bugs Well, the version information for PHP's bundled libgd is bogus (known issue). It is only relevant that it is the bundled libgd, and in that case PHP's version is relevant. The point is that both bundled and external libgd have been developed somewhat independently, and only the bundled libgd is integrated with the Zend memory manager. We are doing our best to keep (or better to bring) them in sync. This is particurlary hard for (parts of) gd_interpolation.c, which have rather different implementations in bundled and external libgd. Previous Comments: ------------------------------------------------------------------------ [2020-06-04 16:33:17] rubik99 at pokemail dot net I am new to PHP and GD I was unsure if php_gd2.dll included in Windows versions is a PHP-specific dll or just a very old official GD dll. This bug has obviously been fixed in actual GD. Cannot find information on using latest GD with PHP (I have no compiler available) so am dependant on official PHP windows download Also confused why PHP bundles old GD version with known security bugs ------------------------------------------------------------------------ [2020-06-04 16:26:46] rubik99 at pokemail dot net Description: ------------ imagescale adds a bottom and right black border if the mode used is IMG_BICUBIC This is dependant on the GD version not PHP version GD versions that fail: The official Windows php.exe (7.4.5) uses GD "bundled (2.1.0 compatible)" The official Windows php.exe (7.2.30) uses GD "bundled (2.1.0 compatible)" http://phpfiddle.org/ (PHP 7.1.18) uses GD "bundled (2.1.0 compatible)" One of my site hosts (PHP 7.0.33) uses GD "bundled (2.1.0 compatible)" GD versions that pass: https://rextester.com/ (PHP 7.2.24) uses GD 2.2.5 https://paiza.io/ (PHP 7.4.1) uses GD 2.2.5 https://www.tutorialspoint.com/ (PHP 7.1.8) uses GD 2.2.4 LibGD 2.3.0 (March 2020) contains security fixes PHP 7.4.5 source file "ext/gd/libgd/gd.h" defines GD version as 2.0.35 (<=2015) Test script: --------------- function test($image, $desc) { echo $desc . ' - Test Result: ' . (imagecolorat($image, imagesx($image) - 1 , imagesy($image) - 1) != 0x000000 ? 'pass' : 'fail') . '<br>'; //line below displays image //ob_start(); imagepng($image); $imageString = ob_get_clean();echo '<img src="data:image/png;base64, ' . base64_encode($imageString) . '" /><br><br>'; } echo 'PHP: ' . phpversion(). ' GD: ' . gd_info()["GD Version"] . '<br>'; $size = 32; $src = imagecreatetruecolor($size, $size); imagefilledrectangle($src, 0, 0, $size - 1 , $size - 1, 0xff00ff);//magenta test($src, 'No scaling'); test(imagescale($src, $size * 2, $size * 2), 'Scale 200%, default mode'); test(imagescale($src, $size / 2, $size / 2), 'Scale 50%, default mode'); test(imagescale($src, $size * 2, $size * 2, IMG_BICUBIC), 'Scale 200%, IMG_BICUBIC mode'); test(imagescale($src, $size / 2, $size / 2, IMG_BICUBIC), 'Scale 50%, IMG_BICUBIC mode'); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79676&edit=1

« previous php.bugs (#227329) next »