Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add glow or a shadow to text in PHP's GD library? [closed]

Tags:

php

gd

Is it possible to add glow or a shadow to text in GD? Currently I am using the imagettftext function.

like image 673
Andrew G. Johnson Avatar asked Mar 20 '13 03:03

Andrew G. Johnson


1 Answers

I ran into this problem and created a new function called imagettftextblur which I've released as open source at https://github.com/andrewgjohnson/imagettftextblur

Here is how to add a shadow:

imagettftextblur($image,$size,0,$x + 3,$y + 3,$shadow_color,$font,$string,1); // 1 can be higher to increase blurriness of the shadow
imagettftextblur($image,$size,0,$x,$y,$text_color,$font,$string);
like image 77
Andrew G. Johnson Avatar answered Nov 15 '22 21:11

Andrew G. Johnson