Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: GD Wordwrap

  1. #1
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default GD Wordwrap

    http://www.ffwbmarion.com/imagergd/t...it%20is%20test

    How can I get this to wrap to a new line?

    I cant figure out the imagettfbox

  2. #2
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    90

    Latest Awards:

    Default

    Is this for H-R by any chance?

  3. #3
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Yes it is

  4. #4
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    90

    Latest Awards:

    Default

    Yay more good features

    EDIT: Use wordwrap() ?
    Last edited by Robbie; 27-12-2006 at 09:03 PM.

  5. #5
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Gifts too

    If only I could figure this out

  6. #6
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    90

    Latest Awards:


  7. #7
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    No but thanks tho. I already tried that.

    Its something to do with imagettfbox

  8. #8
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    90

    Latest Awards:

    Default

    You mean imagettfbbox?

  9. #9
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    yea that

  10. #10
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    90

    Latest Awards:

    Default

    This was on php.net, helpful?

    PHP Code:
    <?php

    function imageWordWrapBBox $Text$Width 650$FontSize 10$Font './fonts/arial.ttf' )
    {
       
    $Words split ' '$Text );
       
    $Lines = array ( );
       
    $Line  '';

       foreach ( 
    $Words as $Word )
       {
           
    $Box  imagettfbbox $FontSize0$Font$Line $Word );
           
    $Size $Box[4] - $Box[0];
           if ( 
    $Size $Width )
           {
               
    $Lines[] = trim $Line );
               
    $Line    '';
           }
           
    $Line .= $Word ' ';
       }
       
    $Lines[] = trim $Line );

       
    $Dimensions imagettfbbox $FontSize0$Font'AJLMYabdfghjklpqry019`@$^&*(,' );
       
    $lineHeight $Dimensions[1] - $Dimensions[5];

       return array ( 
    $lineHeight$Lines$lineHeight count $Lines ) );
    }

    function 
    imageWordWrap $Text$Width$Color$X 0$Y 0$FontSize 10$Font './fonts/arial.ttf' )
    {
       
    $Data $this->imageWordWrapBBox $Text$Width$FontSize$Font );

       foreach ( 
    $Data[1] as $Key => $Line )
       {
           
    $locX $X;
           
    $locY $Y + ( $Key $Data[0] );
           
    imagettftext $this->Image$FontSize0$locX$locY$Color$Font$Line );
       }

       return 
    $Data;
    }
    ?>

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •