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 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: GD Wordwrap

  1. #11
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Grr I need to start looking into GD again.

    I stopped using it when I just couldnt find out aligning of the text pmsl.

    Probs something which is REALLY easy aswell -.-

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

    Latest Awards:

    Default

    PHP Code:
                            $arr imagettfbbox(6.40$font$text2);
                            
    $width $arr[2] - $arr[0];
                            
    $x imagesx($crop) - $width $diff-21;



    imagettftext($crop6.40$x70$black$fontstripslashes($text2)); 
    Aligns text all the way right

    like the name in this:
    http://www.ffwbmarion.com/imagergd/t...s%20are%20here!

  3. #13
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Oo. Thanks ALOT Kevin

    *hugglez*

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

    Latest Awards:

    Default

    Try to find me word wrap PLZZZ

  5. #15
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Yah, Hokay.

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

    Latest Awards:

    Default

    PHP Code:
    <?php 

    function imageWordWrapBBox $text$Width$FontSize$Font

       
    $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$Y$FontSize$Font

       
    $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

    $text "hey";
    $font "Bold.ttf";
    $url2 "troph.gif";
    $crop imagecreatefromgif($url2);
    $black imagecolorallocate($crop1278543);
    echo 
    imageWordWrap($text650$black006.4$font);
    ?>

    Fatal error: Call to a member function on a non-object in /home/ffwb/public_html/imagergd/test33.php on line 29

    I get this

  7. #17
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Kevin could you help me

    At: http://mini-i.fm/imager/pedestal_new...on&badge=staff

    I would like it to not go off the screen but automatically move the text to the left or whatever like in your version of the script.

    Would you be able to help me on how to do this?
    Last edited by Invent; 27-12-2006 at 10:47 PM.

  8. #18
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Edit: Don't actually think it would help && ignore my above post, I coded it wrong. It now works
    Last edited by Invent; 27-12-2006 at 11:28 PM.

Page 2 of 2 FirstFirst 12

Posting Permissions

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