[]{}-+_-="; $box = imagettfbbox($size, 0, $font, $chars); return $box[3]; } function bubble($username, $hotel, $msg, $format, $save = false) { $hotels = array("au" => "com.au", "com.au" => "com.au", "br" => "com.br", "com.br" => "com.br", "ca" => "ca", "dk" => "dk", "fi" => "fi", "fr" => "fr", "de" => "de", "it" => "it", "nl" => "nl", "no" => "no", "sg" => "sg", "com.sg" => "sg", "es" => "es", "se" => "se", "ch" => "ch", "uk" => "co.uk", "co.uk" => "co.uk", "us" => "com", "com" => "com"); $username = empty($username) ? "Habbo" : trim($username); $hotel = empty($hotel) || !array_key_exists($hotel, $hotels) ? "co.uk" : $hotels[$hotel]; $msg = empty($msg) ? "Message " : trim($msg) . " "; $format = empty($format) ? "say" : $format; $dip = get_dip("volterb.ttf", 7); $box = imagettfbbox(7, 0, "volterb.ttf", $username . ":"); $name = imagecreate(abs($box[2] - $box[0]), abs($box[5] - $dip)); $bg = imagecolorallocate($name, 255, 255, 255); $color = $format == "whisper" ? imagecolorallocate($name, 164, 164, 164) : imagecolorallocate($name, 0, 0, 0); imagettftext($name, 7, 0, -$box[0], abs($box[5] - $box[3]) - $box[1], $color, "volterb.ttf", $username . ":"); imagecolortransparent($name, $bg); for($x = 0; $x < imagesx($name); $x++) { for($y = 0; $y < imagesy($name); $y++) { if(imagecolorat($name, $x, $y) == 1) imagesetpixel($name, $x, $y, $color); else imagesetpixel($name, $x, $y, $bg); } } $font = $format == "shout" ? "volterb.ttf" : "volter.ttf"; $dip = get_dip($font, 7); $box = imagettfbbox(7, 0, $font, $msg); $text = imagecreate(abs($box[2] - $box[0]), abs($box[5] - $dip)); $bg = imagecolorallocate($text, 255, 255, 255); $color = $format == "whisper" ? imagecolorallocate($text, 164, 164, 164) : imagecolorallocate($text, 0, 0, 0); imagettftext($text, 7, 0, -$box[0], abs($box[5] - $box[3]) - $box[1], $color, $font, $msg); imagecolortransparent($text, $bg); for($x = 0; $x < imagesx($text); $x++) { for($y = 0; $y < imagesy($text); $y++) { if(imagecolorat($text, $x, $y) == 1 || imagecolorat($text, $x, $y) == 3) imagesetpixel($text, $x, $y, $color); else imagesetpixel($text, $x, $y, $bg); } } $head = imagecreatefromgif("http://www.habbo." . $hotel . "/habbo-imaging/avatarimage?user=" . $username . "&action=wlk,lay,spk&direction=3&head_direction=2&gesture=&size=s&img_format=gif"); $height = 36; for($y = 0; $y < 10; $y++) { for($x = 0; $x < imagesx($head); $x++) { if(imagecolorat($head, $x, $y)) break 2; } $height--; } $start = $height - 26; $bubble = imagecreatetruecolor(imagesx($name) + imagesx($text) + 43, $height); $green = imagecolorallocate($bubble, 0, 255, 0); $black = imagecolorallocate($bubble, 0, 0, 0); imagefill($bubble, 0, 0, $green); imagecolortransparent($bubble, $green); $left = imagecreatefromgif("gfx/bubble_left.gif"); $center = imagecreatefromgif("gfx/bubble_center.gif"); $right = imagecreatefromgif("gfx/bubble_right.gif"); $arrow = imagecreatefromgif("gfx/bubble_arrow.gif"); imagecopymerge($bubble, $left, 0, $start, 0, 0, 29, 22, 100); for($i = 1; $i <= (imagesx($bubble) - 34); $i++) imagecopymerge($bubble, $center, 28 + $i, $start, 0, 0, 1, 22, 100); imagecopymerge($bubble, $right, imagesx($bubble) - 5, $start + 1, 0, 0, 5, 20, 100); imagecopymerge($bubble, $arrow, ceil(imagesx($bubble) / 2) - 3, $start + 21, 0, 0, 7, 5, 100); imagecopymerge($bubble, $name, 31, $start + 7, 0, 0, imagesx($name), imagesy($name), 100); imagecopymerge($bubble, $text, 36 + imagesx($name), $start + 7, 0, 0, imagesx($text), imagesy($text), 100); $back = imagecreatefromgif("http://www.habbo." . $hotel . "/habbo-imaging/avatarimage?user=" . $username . "&action=std&direction=7&head_direction=7&gesture=&size=l&img_format=gif"); $rgb_at = imagecolorat($back, 35, 65); $rgb = imagecolorsforindex($back, $rgb_at); $bg_main = imagecolorallocate($bubble, $rgb["red"], $rgb["green"], $rgb["blue"]); $bg_shadow = imagecolorallocate($bubble, floor($rgb["red"] / 2), floor($rgb["green"] / 2), floor($rgb["blue"] / 2)); imagefilledrectangle($bubble, 3, $start + 2, 21, $start + 19, $bg_main); imagefilledrectangle($bubble, 2, $start + 3, 2, $start + 18, $bg_main); imagefilledrectangle($bubble, 1, $start + 5, 1, $start + 16, $bg_main); imagefilledrectangle($bubble, 5, $start + 1, 26, $start + 1, $bg_main); imagefilledrectangle($bubble, 5, $start + 20, 26, $start + 20, $bg_main); imagefilledrectangle($bubble, 22, $start + 2, 25, $start + 7, $bg_main); imagefilledrectangle($bubble, 22, $start + 8, 23, $start + 9, $bg_main); imagefilledrectangle($bubble, 22, $start + 15, 25, $start + 19, $bg_main); imagefilledrectangle($bubble, 22, $start + 13, 23, $start + 14, $bg_main); imagesetpixel($bubble, 24, $start + 8, $bg_main); imagesetpixel($bubble, 22, $start + 10, $bg_main); imagesetpixel($bubble, 22, $start + 12, $bg_main); imagesetpixel($bubble, 24, $start + 14, $bg_main); imagefilledrectangle($bubble, 26, $start + 2, 26, $start + 8, $bg_shadow); imagefilledrectangle($bubble, 25, $start + 8, 25, $start + 9, $bg_shadow); imagefilledrectangle($bubble, 24, $start + 9, 24, $start + 10, $bg_shadow); imagefilledrectangle($bubble, 23, $start + 10, 23, $start + 12, $bg_shadow); imagefilledrectangle($bubble, 24, $start + 12, 24, $start + 13, $bg_shadow); imagefilledrectangle($bubble, 25, $start + 13, 25, $start + 14, $bg_shadow); imagefilledrectangle($bubble, 26, $start + 14, 26, $start + 19, $bg_shadow); imagesetpixel($bubble, 27, $start + 1, $bg_shadow); imagesetpixel($bubble, 27, $start + 20, $bg_shadow); imagesetpixel($bubble, 22, $start + 11, $bg_shadow); imagecopymerge($bubble, $head, -1, $start + -10, 0, 0, 29, 31, 100); if($save) { imagepng($bubble, "bubbles/bubble_" . time() . ".png"); return "bubbles/bubble_" . time() . ".png"; } header("Content-type: image/png"); imagepng($bubble); } if(!defined("ACCESS")) bubble(@$_GET["name"], @$_GET["hotel"], @$_GET["text"], @$_GET["format"]); ?>