It looks like you have the wrong parameters in your call to imagettftext.
Presumably, the 5 corresponds to the font used in imagestring
, but has no place in imagettftext
. You also need to specify the size and angle.
For example:
imagettftext($newImage, 12, 45, 10, 27, $txtColor, $font_path, $ranStr);
^^ ^^
|| ||
|| ------ angle
----------- size
In this example:
size=12px or 12pt, depending on whether you're using GD1 or GD2
angle = 45°
Obviously, you'll want to use your own values here.
If it still isn't working, then it's likely that the path to your font file is wrong. Check to see if it's in the same folder as the PHP script.