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 17
  1. #1
    Join Date
    May 2010
    Posts
    23
    Tokens
    0

    Default HELP: Speech Bubble Generator

    On a previous post, I was asking how to get a Speech Bubble Generator I ripped from a website to generate pictures. This time, I'm asking how to code the page which has the speech bubble you generated on it. I coded my own Speech Bubble Generator. I got it to generate through habboemotion.com's "bubble.php" file which is what I'm looking for.
    here is the JavaScript I coded:

    Code:
    /* the function that gathers all the info */
    function submitBubblegen()
    {
    var country = document.getElementById('country').value;
    var habbo = document.getElementById('habbo').value;
    var text = escape(document.getElementById('text').value);
    var format = document.getElementById('format').value;
    var habbo_avatar = "http://habboemotion.com/usable/bubble/bubble.php?habbo="+habbo+"&country="+country+"&text="+text+"&format="+format+"";
    var habbourl = document.getElementById('habbourl').value = habbo_avatar;
    var habboimg = document.getElementById('habboimg').src = habbo_avatar;
    }
    If you see, I put habboemotion.com's bubble.php url so it could generate the speech bubbles. It works pretty good, I just wanna figure out how to code that bubble.php page into generating that image onto my site. Does anyone know how to code this page?

  2. #2
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    You'll need to learn PHP and how to use the PHP GD image library for creating images.

  3. #3
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Correct me if I'm wrong but I don't see why you need info from Habbo to create this.

    Just use an image of the speech bubble as use GD (as Apolva said) to dynamically create the text.

    First create a form that asks what text you want to display. Name the field "msg" (without the quotes). Use the code below (I commented it so you should understand what's happening within the code). You'll have to upload the font you want to use to the server you're hosting this on and the image of the speech bubble as well. Then change the links in the code. Also, you'll have to mess with $x and $y to position the text correctly. Let me know if you have any problems.

    PHP Code:
    <?php
    $txt 
    $_POST['msg']; // Text you want displayed (pulled from the form)
    $x 'CHANGEME'// x-coordinate
    $y 'CHANGEME'// y-coordinate
     
    $font 'CHANGE ME'// Path to font
    $fontsize '12'// Size of the font in px
    $angle '0'// Angle of the text
    $img imagecreatefrompng('CHANGEME'); // Specifies the image we want to use
    $colour imagecolorallocate($img255255255); // Specifies the font colour
    imagettftext($img$fontsize$angle$x$y$colour$font$txt); // Displays our text on the image
    imagepng($img);
    imagedestroy($img);
    ?>
    Vouches
    [x][x]

  4. #4
    Join Date
    Jul 2007
    Location
    UK
    Posts
    2,470
    Tokens
    2,975

    Latest Awards:

    Default

    Quote Originally Posted by Fazon View Post
    Correct me if I'm wrong but I don't see why you need info from Habbo to create this.

    Just use an image of the speech bubble as use GD (as Apolva said) to dynamically create the text.

    First create a form that asks what text you want to display. Name the field "msg" (without the quotes). Use the code below (I commented it so you should understand what's happening within the code). You'll have to upload the font you want to use to the server you're hosting this on and the image of the speech bubble as well. Then change the links in the code. Also, you'll have to mess with $x and $y to position the text correctly. Let me know if you have any problems.

    PHP Code:
    <?php
    $txt 
    $_POST['msg']; // Text you want displayed (pulled from the form)
    $x 'CHANGEME'// x-coordinate
    $y 'CHANGEME'// y-coordinate
     
    $font 'CHANGE ME'// Path to font
    $fontsize '12'// Size of the font in px
    $angle '0'// Angle of the text
    $img imagecreatefrompng('CHANGEME'); // Specifies the image we want to use
    $colour imagecolorallocate($img255255255); // Specifies the font colour
    imagettftext($img$fontsize$angle$x$y$colour$font$txt); // Displays our text on the image
    imagepng($img);
    imagedestroy($img);
    ?>
    for the little image of the habbo's head in the text box

    Have you tired just copying the file from habbo emotion?

  5. #5
    Join Date
    Apr 2010
    Location
    Newcastle
    Posts
    655
    Tokens
    50

    Default

    You can pretend that you have the script (make the image come from your own domain, for example if you need it for SSL, which you probably don't) using something like:
    <?php
    header("Content-type: image/png");
    readfile("http://habboemotion.com/usable/bubble/bubble.php?habbo=".$_GET['habbo']);
    ?>

    Note that it will still just download the file and therefore relies on the site to be up (which isn't exactly ideal + is slower).

  6. #6
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    If you know the URL that Habbo uses to dynamically pull images of certain Habbo's then it could be done easily.

    If you want to just rip it (not recommended) then try this:



    edit - wait made a bunch of errors, don't use the code yet im working on it.

    edit 2 - is this what you want? http://totalbasketball.herobo.com/test/habbotest.php
    if so, let me know and I'll fix up it up for you (add the country list options, say/whisper/shout, etc.)
    Last edited by Trigs; 28-06-2010 at 01:52 AM.

  7. #7
    Join Date
    May 2010
    Posts
    23
    Tokens
    0

    Default

    Fazon, that is exactly what I want.

  8. #8
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    I'll post the code tonight, I'm a bit busy right now.

    Keep in mind that this is hotlinking habboemotion.com and they might not take to kindly to it.

  9. #9
    Join Date
    May 2010
    Posts
    23
    Tokens
    0

    Default

    Fazon, i'm trying to use the GD imaging thing but im having problems. can you code the form 4 me? cuz idk what im doing. And where do u put the form?

  10. #10
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Hold on, I'll send you the complete code. I recommend you learn some PHP though so next time you know how to do it yourself.

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
  •