Im making a small site for a friend, and we wanted to use a special font. I have implemented a function I have called txt2img. With this, one can get some text converted to a
-tag which points to a created img like this:
$text = "String from different places here";
txt2img($text, array(
'font' => 'fontfile.ttf',
'size' => '50',
'color' => array(255,0,0) // makes a red colored text
...
);
I was wondering if this is something I should contribute (I'll be happy to do so).
But I could use some guidence on integrating it with Drupal. It needs to locate font files, and be able to write to a directory which the user must have access to. Currently, I have made a "txt2img" with "cache" and "fonts" as subfolders. In "fonts" resides the .ttf fonts I want to use, the .png images are written to "cache". I suppose most users wouldn't want to bother to much with permissions, so a central location would be nice for the cache. Therefore I wanted to use the "files" directory in the site root. However, I wasn't able to read files from there. Is it possible to use it for this?
What naming should I use? I suppose most theme designers would want the function name to be small, that's why I called it txt2img() in the first place.
Where should I store the script-file(s)? I suppose a module wouldn't be very helpful for this. I solution may be to simply have the theme editors who want to use it bundle it up with their theme. That would ensure use of function names ++ corresponds.
Also, I need to get some information. What's the best way to get the following:
* Path to theme-directory (for "fonts" folder)
* Url path to the "cache"-folder (either in theme or files or...) for use in
-tag.
Thanks.