1

I am trying to use a custom font in an image made with PHP GD.

I intend to call int imageloadfont(string $file), but I'm not sure what $file to give if I want to get a Google Font directly from their website.

Do I need to download the font or is there a way to get it remotely?

SteeveDroz
  • 6,006
  • 6
  • 33
  • 65

1 Answers1

2

You can use the .ttf file from Google servers directly if you have allow_url_fopen enabled in your PHP installation. Look into the stylesheet to get the correct url.

However, for best performance, availability and security, you should download the file and use a local path.

Martin Müller
  • 2,565
  • 21
  • 32
  • Ouch! Each time I see `allow_url_fopen`, I die a little bit inside. All right, I'll download that file and put it on my server. Thanks for your answer! – SteeveDroz May 04 '16 at 13:58