Bug #79676 [Com]: imagescale adds black border with IMG_BICUBIC

From: Date: Thu, 04 Jun 2020 16:33:17 +0000
Subject: Bug #79676 [Com]: imagescale adds black border with IMG_BICUBIC
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227325@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 Comment by: rubik99 at pokemail dot net Reported by: rubik99 at pokemail dot net Summary: imagescale adds black border with IMG_BICUBIC Status: Open Type: Bug Package: GD related Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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 (#227325) next »