Bug #80335 [Opn->Fbk]: Imagecolorat and imagecreatefrompng glitch
| From: | requinix@php.net | Date: | Sun, 08 Nov 2020 01:20:23 +0000 |
| Subject: | Bug #80335 [Opn->Fbk]: Imagecolorat and imagecreatefrompng glitch | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-230181@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80335&edit=1
ID: 80335
Updated by: requinix@php.net
Reported by: jagja870 at school dot lu
Summary: Imagecolorat and imagecreatefrompng glitch
-Status: Open
+Status: Feedback
Type: Bug
Package: *Graphics related
Operating System: Windows 10
PHP Version: 7.3.24
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
The code you posted combines file_get_contents with imagecreatefrompng. Those two will never work
together. Please post the exact code you had problems with.
Previous Comments:
------------------------------------------------------------------------
[2020-11-08 01:16:32] jagja870 at school dot lu
Description:
------------
if you create an image source from an image file, with imagecreatefrompng($path)
$path leads to a png image
you will come to a bug, where if u use imagecolorat() will always return an rgb value of 0.
but if you change it to imgcreatefromstring($path) and load the png file it also won't work.
imagecolorat() only works with jpg files in the end.
Test script:
---------------
$imageSource = file_get_contents("uploads/"."myfile.png");
$imageSource = imagecreatefrompng($imageSource);
for($x=0; $x<$imageX;$x++){
for($y=0;$y<$imageY;$y++){
$rgb = imagecolorat($imageSource, $x, $y);
}
}
Expected result:
----------------
All returns get a value of 0.
Actual result:
--------------
The actual result should have returned the rgb value of the pixel in a png file.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80335&edit=1