[GD]Could not find/open font - font problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • carramba
    Guest replied
    Re: [GD]Could not find/open font - font problem

    "jn" <usenet*spamist ehsuckremovetor eply*@jasonnorr is.net> wrote in message news:<7ht3c.225 682$jH.2546473@ twister.tampaba y.rr.com>...[color=blue]
    > "carramba" <carramba@bootr e.com> wrote in message
    > news:a4e7fbcf.0 403091200.11414 3c@posting.goog le.com...[color=green]
    > > I know this subjekt was up several times but Icant get it work
    > > use gd2 on win32
    > > <?
    > > putenv('GDFONTP ATH=f:\swd\font ');
    > > $font = "f:/swd/font/arial.ttf";
    > > $im = imagecreate (250, 28);
    > > $black = ImageColorAlloc ate ($im, 0, 0, 0);
    > > $yellow = ImageColorAlloc ate ($im, 235, 235, 51);
    > > ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
    > > "comming text or not?");
    > > ImagePNG($im,te st.png);
    > >
    > > ?>
    > > <img src="test.png" alt="image">
    > >
    > > but I allway get error about not finding font ..
    > >
    > > what should I do?
    > >[/color]
    >
    > I hate that bug. I got mine to work on Windows and Linux by only giving it
    > the font name (it adds .ttf by itself) and by using realpath().
    >
    > Create a folder called "font" where your script is, and put your font there.
    >
    > <?
    >
    > $fontpath = realpath('./font/');
    > putenv('GDFONTP ATH='.$fontpath );
    > $font = "arial";[/color]


    Thanx you very mutch! it worked like a rolex! hehe
    that was a nasty bug... and with bad documentation, according php.net
    it should by enought to point with absolut path..

    enyway, thank you!




    [color=blue]
    > $im = imagecreate (250, 28);
    > $black = ImageColorAlloc ate ($im, 0, 0, 0);
    > $yellow = ImageColorAlloc ate ($im, 235, 235, 51);
    > ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font, "comming text or not?");
    > ImagePNG($im,te st.png);
    > ?>
    >
    > <img src="test.png" alt="image">
    >
    > I hope this works for you...[/color]

    Leave a comment:


  • jn
    Guest replied
    Re: [GD]Could not find/open font - font problem

    "carramba" <carramba@bootr e.com> wrote in message
    news:a4e7fbcf.0 403091200.11414 3c@posting.goog le.com...[color=blue]
    > I know this subjekt was up several times but Icant get it work
    > use gd2 on win32
    > <?
    > putenv('GDFONTP ATH=f:\swd\font ');
    > $font = "f:/swd/font/arial.ttf";
    > $im = imagecreate (250, 28);
    > $black = ImageColorAlloc ate ($im, 0, 0, 0);
    > $yellow = ImageColorAlloc ate ($im, 235, 235, 51);
    > ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
    > "comming text or not?");
    > ImagePNG($im,te st.png);
    >
    > ?>
    > <img src="test.png" alt="image">
    >
    > but I allway get error about not finding font ..
    >
    > what should I do?
    >[/color]

    I hate that bug. I got mine to work on Windows and Linux by only giving it
    the font name (it adds .ttf by itself) and by using realpath().

    Create a folder called "font" where your script is, and put your font there.

    <?

    $fontpath = realpath('./font/');
    putenv('GDFONTP ATH='.$fontpath );
    $font = "arial";
    $im = imagecreate (250, 28);
    $black = ImageColorAlloc ate ($im, 0, 0, 0);
    $yellow = ImageColorAlloc ate ($im, 235, 235, 51);
    ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font, "comming text or not?");
    ImagePNG($im,te st.png);
    ?>

    <img src="test.png" alt="image">

    I hope this works for you...


    Leave a comment:


  • CountScubula
    Guest replied
    Re: [GD]Could not find/open font - font problem

    Not sure, becouse it looks right, but what about the forward slash?

    I take it this is a windows install? try: $font =
    "f:\\swd\\font\ \arial.ttf";
    --
    Mike Bradley
    http://www.gzentools.com -- free online php tools
    "carramba" <carramba@bootr e.com> wrote in message
    news:a4e7fbcf.0 403091200.11414 3c@posting.goog le.com...[color=blue]
    > I know this subjekt was up several times but Icant get it work
    > use gd2 on win32
    > <?
    > putenv('GDFONTP ATH=f:\swd\font ');
    > $font = "f:/swd/font/arial.ttf";
    > $im = imagecreate (250, 28);
    > $black = ImageColorAlloc ate ($im, 0, 0, 0);
    > $yellow = ImageColorAlloc ate ($im, 235, 235, 51);
    > ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
    > "comming text or not?");
    > ImagePNG($im,te st.png);
    >
    > ?>
    > <img src="test.png" alt="image">
    >
    > but I allway get error about not finding font ..
    >
    > what should I do?[/color]


    Leave a comment:


  • carramba
    Guest started a topic [GD]Could not find/open font - font problem

    [GD]Could not find/open font - font problem

    I know this subjekt was up several times but Icant get it work
    use gd2 on win32
    [code=html]<?
    putenv('GDFONTP ATH=f:\swd\font ');
    $font = "f:/swd/font/arial.ttf";
    $im = imagecreate (250, 28);
    $black = ImageColorAlloc ate ($im, 0, 0, 0);
    $yellow = ImageColorAlloc ate ($im, 235, 235, 51);
    ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
    "comming text or not?");
    ImagePNG($im,te st.png);

    ?>
    <img src="test.png" alt="image">[/code]

    but I allway get error about not finding font ..

    what should I do?
    Last edited by pbmods; Feb 25 '09, 08:11 PM. Reason: Added CODE tags.
Working...