Bug #79676 [NEW]: imagescale adds black border with IMG_BICUBIC
| From: | rubik99 at pokemail dot net | Date: | Thu, 04 Jun 2020 16:26:46 +0000 |
| Subject: | Bug #79676 [NEW]: imagescale adds black border with IMG_BICUBIC | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-227323@lists.php.net to get a copy of this message | ||
From: rubik99 at pokemail dot net
Operating system: Irrelevant
PHP version: Irrelevant
Package: GD related
Bug Type: Bug
Bug description:imagescale adds black border with IMG_BICUBIC
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 bug report at https://bugs.php.net/bug.php?id=79676&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79676&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79676&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79676&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79676&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79676&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79676&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79676&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79676&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79676&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79676&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79676&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79676&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79676&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79676&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79676&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79676&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79676&r=mysqlcfg