imagecolorallocatealpha
PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8
imagecolorallocatealpha - Allocate a color for an image
Manual
imagecolorallocatealpha(
GdImage$image,
int$red,
int$green,
int$blue,
int$alpha ): int|false
imagecolorallocatealpha behaves identically to imagecolorallocate with the addition of the transparency parameter alpha.
Parameters
- image
A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor.
- red
-
Value of red component.
- green
-
Value of green component.
- blue
-
Value of blue component.
- alpha
-
A value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.
Return Values
A color identifier or false if the allocation failed.
Warning:
This function may return Boolean false, but may also return a non-Boolean value which evaluates to false. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.
Changelog
Version | Description |
8.0.0 | image expects a GdImage instance now; previously, a resource was expected. |