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 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    I know.. this is using PHP GD.

    And its making me mad

  2. #12
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    I'm assuming there's an image for each character, which are then joined using the imagecopymerge function. It's pretty simple, you'll just need to get the width of each character, add it together, create the image and then place each character (you could do it with a foreach loop).
    kinda quit.

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

    Latest Awards:

    Default

    Could you help joshua?

    Im not a noob at this but I just haven't worked with GD that much

  4. #14
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    I'll write a basic script you can ammend to fit your needs.

    I had a similar script I wrote for someone else which I could structure it around:
    PHP Code:
    <?php

      
    require ('config.php');
      
    header("Content-type: image/png");

      
    // Check Message
      
    if(preg_match("/^[a-zA-Z0-9 ]{0,30}$/"$_GET['message']) && !empty($_GET['message'])) {
        
    $chars str_split(str_replace(' ''_'$_GET['message']));
      } else {
        
    $chars str_split('Invalid_Message');
      }

      
    // Assign font variable
      
    $fontDirectory $fonts[$_GET['font']];
      if(
    $fontDirectory == ''$fontDirectory 'test';

      
    // Count size and create images
      
    foreach($chars as $char) {
        
    $cl $fontDirectory.'/'.$char.'.png';
        
    $charsImgs[] = imagecreatefrompng($cl);
        @list(
    $width) = getimagesize($cl) or exit;
        
    $charsWidth[] = $width;
        
    $imgWidth $imgWidth+$width;
      }

      
    // Create and merge final image
      
    $imgWidth = ($pos*2)+$imgWidth;
      
    $img imagecreate($imgWidthheight);
      
    $bg imagecolorallocate($img255255255);
      foreach(
    $charsImgs as $charsImg) {
        
    $width array_shift($charsWidth);
        
    imagecopymerge($img$charsImg$pos000$widthheight100);
        
    $pos $pos+$width;
      }

      
    // Flush image
      
    imagepng($img);
      
    imagedestroy($img);
      exit;

    ?>
    File "config.php":
    PHP Code:
    <?php

      
    # CONFIG

      #Image height:
      
    define("height"50);

      
    #Left and right margin:
      
    $pos '10';

      
    #Font and its directory (more may be added):
      
    $fonts['test'] = 'test';
      
    $fonts['blah'] = 'blah';

      
    # CONFIG END --

    ?>
    Create a folder with the name of your font, bearing each character (in PNG format). The space image should be named "_.png", as you can't have spaces in some O/Ss file names. Modify config.php to fit your needs. Don't worry about paying me.
    Last edited by nets; 03-12-2006 at 08:43 PM.
    kinda quit.

  5. #15
    Join Date
    Nov 2006
    Location
    Leeds, Yorkshire
    Posts
    992
    Tokens
    0

    Default

    Quote Originally Posted by joshua View Post
    I'll write a basic script you can ammend to fit your needs.
    Could you supply me with the script too, thanks.


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

    Latest Awards:

    Default

    Thanks joshua.

    I will pay you when I get my paypal account unlocked

  7. #17
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Bump. About paying, I wrote a script a similar script a while ago, so there wasn't much coding to do (thanks for the offer though). I've added the script to my previous post.
    Last edited by nets; 03-12-2006 at 08:46 PM.
    kinda quit.

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

    Latest Awards:

    Default

    http://www.ffwbmarion.com/imagergd/t...p?message=test

    Warning: Cannot modify header information - headers already sent by (output started at /home/ffwb/public_html/imagergd/configj.php:17) in /home/ffwb/public_html/imagergd/testj.php on line 4

    Fatal error: Call to undefined function: str_split() in /home/ffwb/public_html/imagergd/testj.php on line 8
    To those not using PHP 5:

    PHP Code:
    <?php 
      
    require ('config.php'); 
      if(!
    function_exists('str_split')){ 
       function 
    str_split($string,$split_length=1){ 
           
    $count strlen($string);  
           if(
    $split_length 1){ 
               return 
    false;  
           } elseif(
    $split_length $count){ 
               return array(
    $string); 
           } else { 
               
    $num = (int)ceil($count/$split_length);  
               
    $ret = array();  
               for(
    $i=0;$i<$num;$i++){  
                   
    $ret[] = substr($string,$i*$split_length,$split_length);  
               }  
               return 
    $ret
           }      
       }  
    }
      
    // Check Message 
      
    if(preg_match("/^[a-zA-Z0-9 ]{0,30}$/"$_GET['message']) && !empty($_GET['message'])) { 
        
    $chars str_split(str_replace(' ''_'$_GET['message'])); 
      } else { 
        
    $chars str_split('Invalid_Message'); 
      } 
      
    // Assign font variable 
      
    $fontDirectory $fonts[$_GET['font']]; 
      if(
    $fontDirectory == ''$fontDirectory 'test'
      
    // Count size and create images 
      
    foreach($chars as $char) { 
        
    $cl $fontDirectory.'/'.$char.'.png'
        
    $charsImgs[] = imagecreatefrompng($cl); 
        @list(
    $width) = getimagesize($cl) or exit; 
        
    $charsWidth[] = $width
        
    $imgWidth $imgWidth+$width
      } 
      
    // Create and merge final image 
      
    $imgWidth = ($pos*2)+$imgWidth
      
    $img imagecreate($imgWidthheight); 
      
    $bg imagecolorallocate($img255255255); 
      foreach(
    $charsImgs as $charsImg) { 
        
    $width array_shift($charsWidth); 
        
    imagecopymerge($img$charsImg$pos000$widthheight100); 
        
    $pos $pos+$width
      } 
      
    // Flush image 
      
    header("Content-type: image/png"); 
      
    imagepng($img); 
      
    imagedestroy($img); 
      exit; 
    ?>
    Last edited by Dentafrice1; 03-12-2006 at 08:53 PM.

  9. #19
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    It's working fine now?
    Last edited by nets; 03-12-2006 at 08:59 PM.
    kinda quit.

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

    Latest Awards:

    Default

    http://www.ffwbmarion.com/imagergd/t...ge=a&font=blah

    PHP Code:
    <?php     
      
    require ('configj.php');
      if(!
    function_exists('str_split')){ 
       function 
    str_split($string,$split_length=1){ 
           
    $count strlen($string);  
           if(
    $split_length 1){ 
               return 
    false;  
           } elseif(
    $split_length $count){ 
               return array(
    $string); 
           } else { 
               
    $num = (int)ceil($count/$split_length);  
               
    $ret = array();  
               for(
    $i=0;$i<$num;$i++){  
                   
    $ret[] = substr($string,$i*$split_length,$split_length);  
               }  
               return 
    $ret
           }      
       }  
    }

      
    // Check Message 
      
    if(preg_match("/^[a-zA-Z0-9 ]{0,30}$/"$_GET['message']) && !empty($_GET['message'])) { 
        
    $chars str_split(str_replace(' ''_'$_GET['message'])); 
      } else { 
        
    $chars str_split('Invalid_Message'); 
      } 

      
    // Assign font variable 
      
    $fontDirectory $fonts[$_GET['font']]; 
      if(
    $fontDirectory == ''$fontDirectory 'test'

      
    // Count size and create images 
      
    foreach($chars as $char) { 
        
    $cl $fontDirectory.'/'.$char.'.gif'
        
    $charsImgs[] = imagecreatefromgif($cl); 
        @list(
    $width) = getimagesize($cl) or exit; 
        
    $charsWidth[] = $width
        
    $imgWidth $imgWidth+$width
      } 

      
    // Create and merge final image 
      
    $imgWidth = ($pos*2)+$imgWidth
      
    $img imagecreate($imgWidthheight); 
      
    $bg imagecolorallocate($img255255255); 
      foreach(
    $charsImgs as $charsImg) { 
        
    $width array_shift($charsWidth); 
        
    imagecopymerge($img$charsImg$pos000$widthheight100); 
        
    $pos $pos+$width
      } 

      
    // Flush image 
      
    header("Content-type: image/png"); 
      
    imagepng($img); 
      
    imagedestroy($img); 
      exit; 

    ?>
    comes up with a broken image

Page 2 of 3 FirstFirst 123 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
  •