Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2689959
D25209.1734741870.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25209.1734741870.diff
View Options
diff --git a/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php b/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php
--- a/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php
+++ b/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php
@@ -183,12 +183,21 @@
'image/png');
}
+ /**
+ * Convert a color from RGBA to a value usable in PHP-GD.
+ * Each RGB color should be expressed as an integer from 0 to 255.
+ * The Alpha Channel should be expressed as a float from 0 to 1.
+ * @param array $rgba array( int Red, int Green, int Blue, float Alpha )
+ * @return int
+ */
private static function rgba2gd($rgba) {
+ // When working with a truecolor image, we can use bitwise operations
+ // https://www.php.net/manual/en/function.imagecolorallocate.php#49168
$r = $rgba[0];
$g = $rgba[1];
$b = $rgba[2];
$a = $rgba[3];
- $a = (1 - $a) * 255;
+ $a = round(((1 - $a) * 255), 0);
return ($a << 24) | ($r << 16) | ($g << 8) | $b;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 00:44 (17 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1016535
Default Alt Text
D25209.1734741870.diff (1 KB)
Attached To
Mode
D25209: Fix PHP 8.1 "implicit conversion from float to int" exception on certain avatar colors which blocks rendering user pages
Attached
Detach File
Event Timeline
Log In to Comment