GD font-path on AWS for a .ttf

Viewed 316

Are there standard fonts with a path available on regular AWS EC2 instances ? I need to provide a full path to a .ttf file to use a basic feature of the GD graphics tool. AWS won't let me upload a .ttf file into the main application files. Do I need to use/set up a S3 bucket? Will the server and the GD tool be able to use a direct path to a .ttf file hosted on S3 ?

Any work-arounds? I would be happy at this point with ANY .ttf font file that would work for GD. I don't need any custom fonts, just a path to any font that the gd tool can access:

more or less here is the code for the node module I created to make images using processed data:

//forum-sig.js

var gd = require('nod-gd')

module.exports{

  createSig: function(text, name){

      var sigimg = gd.createSync(360, 180);
      var red = sigimg.colorAllocate(255, 0, 0)
      var white = sigimg.collorAllocate(255,255,255);

      // set full path to file
      // example var fontPath = '/full/path/to/font.ttf';
      var fontPath = './public/OpenSans-Bold.ttf'  //this path works locally
      //  WHAT path can I use on AWS ? will S3 work? are there public fonts   
      //  on AWS that i can find a path to?

      // Render string in image
      // example img.stringFT(txtColor, fontPath, 24, 0, 10, 60, 'Hello world!');

      sigimg.stringFT(white, fontPath, 18, 0, 15, 35, text)
      sigimg.saveFile('public/images/' + name + '.png');

    }
}

Again this works on my local computer. I believe I successfully loaded the library and node-gyp and node-gd modules. I'm only getting an error that they can't find a font because.. AWS won't seem to upload a .ttf file and I haven't found a way to give a path to one elsewhere.

0 Answers
Related