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
Re: More with imagettfbbox(); absolute url not working? [message #173366 is a reply to message #173363] Tue, 05 April 2011 04:19 Go to previous messageGo to previous message
Mr. B-o-B is currently offline  Mr. B-o-B
Messages: 42
Registered: April 2011
Karma:
Member
jwcarlton cried from the depths of the abyss...

> 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
>


Are you running this on a *nix or windows box?

If $fontfile is a Windows UNC path, it *must* start with //SERVER rather
than \\SERVER
[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: Sat Nov 30 12:43:48 GMT 2024

Total time taken to generate the page: 0.03811 seconds