Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default Whats wrong here [PHP GD]

    Well we have GD installed on our server, or else all the other GD images around the site wouldn't work (Then again, I think you have to set which image types can work)

    Heres the contents of our file:
    Yes, all the urls are correct

    PHP Code:
    <?php

    $name 
    $_GET["habbo"];
    $hotel $_GET["hotel"];

    header("Content-Type: image/gif");

    $im imagecreatefrompng("spotlight.PNG");

    $thumbWidth "60";
    $thumbHeight "120";
    $url "http://www.habbo.$hotel/habbo-imaging/avatarimage?user=$name&action=&direction=4&head_direction=3&gesture=sml&size=l&img_format=png";
    $srcImg imagecreatefrompng($url);
    $origWidth imagesx($srcImg); 
    $origHeight imagesy($srcImg);  
    $thumbImg imagecreate($thumbWidth$thumbHeight);
    imagecopyresized($thumbImg$srcImg0000$thumbWidth$thumbHeightimagesx($thumbImg), imagesy($thumbImg));
    $ImgWhite imagecolorallocate($thumbImg255255255);
    imagefill($thumbImg00$ImgWhite);
    imagecolortransparent($thumbImg$ImgWhite);  
                            
    $font "Volter.ttf";
    $size "6.5";
    $white imagecolorallocate($im255255255);
    $text $name;
    $img_w imagesx($im);
    $img_h imagesy($im);

    imagettftext($im$size0, ($img_w 2)-(strlen($name)*imagefontwidth($font) /2), 130$white$font$name);


    imagegif($im);
    imagedestroy($im);

    die();
    ?>
    Moved by Invent (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks .
    Last edited by Invent; 28-07-2008 at 04:41 PM.

  2. #2
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    What error are you getting?

    EDIT: nvm I think I see the error, you have set the header to gif, but the image is png.

    It either needs to be
    PHP Code:
    header("Content-Type: image/png");

    $im imagecreatefrompng("spotlight.png"); 
    or
    PHP Code:
    header("Content-Type: image/gif");

    $im imagecreatefromgif("spotlight.gif"); 
    Last edited by Decode; 22-07-2008 at 06:41 PM.
    Lets set the stage on fire, and hollywood will be jealous.

  3. #3
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Wow, thanks.

    I just realized how to use GD.

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

    Latest Awards:

    Default

    No Tom, he's outputting it as a gif, so it's fine

  5. #5
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    No Tom, he's outputting it as a gif, so it's fine
    Oh right lol, I didn't know GD could convert images
    Lets set the stage on fire, and hollywood will be jealous.

  6. #6
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Create a PHP page and type the follwing code:
    PHP Code:
    <?php echo phpinfo(); ?>
    It should show you you're PHP info and what extra libraries you have installed like GD , scroll down to the GD section and see if you have the "Freetype" support enabled , you need the freetype library to use the getttftext function which you are using to write the text with .

  7. #7
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    Im unsure but i think that this part of the code needs to be $url = "http://www.habbo.".$hotel."/habbo-imaging/avatarimage?user=$name&action=&direction=4&head_di rection=3&gesture=sml&size=l&img_format=png"; not 100% sure though, its because your using a variable i think.
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  8. #8
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by Joe! View Post
    Im unsure but i think that this part of the code needs to be $url = "http://www.habbo.".$hotel."/habbo-imaging/avatarimage?user=$name&action=&direction=4&head_di rection=3&gesture=sml&size=l&img_format=png"; not 100% sure though, its because your using a variable i think.
    Nope it does not seeing as I use the same method to get my Habbo images for my scripts and it works fine .

  9. #9
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by --ss-- View Post
    Nope it does not seeing as I use the same method to get my Habbo images for my scripts and it works fine .
    Eww..

    PHP Code:
    $url "http://www.habbo."$hotel ."/habbo-imaging/avatarimage?user="$name ."&action=&direction=4&head_direction=3&gesture=sml&size=l&img_format=png"
    Why not just use the GET array thing, instead of creating another variable which contains the value of that.

  10. #10
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Quote Originally Posted by --ss-- View Post
    Create a PHP page and type the follwing code:
    PHP Code:
    <?php echo phpinfo(); ?>
    It should show you you're PHP info and what extra libraries you have installed like GD , scroll down to the GD section and see if you have the "Freetype" support enabled , you need the freetype library to use the getttftext function which you are using to write the text with .
    GD Support - enabled
    GD Version - bundled (2.0.34 compatible)
    FreeType Support - enabled
    FreeType Linkage - with freetype
    FreeType Version - 2.2.1
    GIF Read Support - enabled
    GIF Create Support - enabled
    JPG Support - enabled
    PNG Support - enabled
    WBMP Support - enabled
    XPM Support - enabled
    XBM Support - enabled

    Says its all enabled :S

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
  •