FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » More with imagettfbbox(); absolute url not working?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
More with imagettfbbox(); absolute url not working? [message #173363] Tue, 05 April 2011 03:19 Go to previous message
jwcarlton is currently offline  jwcarlton
Messages: 76
Registered: December 2010
Karma:
Member
I'm still working with imagettfbbox(). The problem I'm having now is
that I can't seem to refer to the TTF file unless it's in the actual
directory as the index.php file; if I give a relative or absolute
path, I'm getting an error:

Warning: imagettfbbox() [function.imagettfbbox]: Could not find/open
font in /home/accountname/public_html/variables.php on line 152

For this system, I have a variables.php file, located at the /
public_html/ directory. This is the file that uses imagettfbbox(),
like so:

$home = "http://www.example.com";

define("F_SIZE", 9);

// This is the problem line, # 152 in the error
define("F_FONT", "arialbd.ttf");

function get_bbox($text) {
return imagettfbbox(F_SIZE, 0, F_FONT, $text);
}


Now, if I'm loading index.php that's in the same directory as
variables.php, then this works fine (obviously). In other directories,
though, it (obviously) can't find the arialbd.ttf file.

In all files, I'm including variables.php like so:

include "../variables.php";

I've tried the following variations, but still get the same errors:

// Found this recommendation somewhere
define("F_FONT", "./arialbd.ttf");

// URLs are supposed to be OK
define("F_FONT", "$home/arialbd.ttf");

// Using no variables, just type the URL straight in
define("F_FONT", "http://www.example.com/arialbd.ttf");

// Thought that a relative path would at least work
// on the second-level directories
define("F_FONT", "../arialbd.ttf");


Finally, I tried removing define(), and switching to global variables,
but had the same error:

$f_size = "9";
$f_font = "$home/arialbd.ttf";

function get_bbox($text) {
global $f_size;
global $f_font;

return imagettfbbox($f_size, 0, $f_font, $text);
}


Can you guys tell me the correct way to define the path to arialbd.ttf
here?

TIA,

Jason
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OpenSSL support => disabled (install ext/openssl)
Next Topic: How to test if .php is using FastCGI?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 11:42:42 GMT 2024

Total time taken to generate the page: 0.04226 seconds