Open Geolim4 opened 6 years ago
Just for the sharing:
If you want to write semi-transparent text, instead of passing hexa color to write(), you can pass an imagecolorallocatealpha ressource:
imagecolorallocatealpha
Classic text:
$image->write( 'myfont.ttf', 'mytext', 10, 290, '10', '0', '666666', 'left' );
Transparent text (with custom opacity from 0 to 127):
$opacity = 100; // from 0 to 127 $image->write( 'myfont.ttf', 'mytext', 10, 290, '10', '0', imagecolorallocatealpha(imagecreatetruecolor(IMAGE_WIDTH, IMAGE_HEIGHT), 0, 0, 0, $opacity), 'left' );
See imagecolorallocatealpha()
Hope this will help some people.
Just for the sharing:
If you want to write semi-transparent text, instead of passing hexa color to write(), you can pass an
imagecolorallocatealpha
ressource:Classic text:
Transparent text (with custom opacity from 0 to 127):
See imagecolorallocatealpha()
Hope this will help some people.