Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
habbo-imaging badge.php
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Detox" data-source="post: 335145" data-attributes="member: 596"><p>Okay so there is my badge.php that is in my current habbo-imaging, but its not creating the group badges in the badge-fill folder nor the cache folder and now I'm getting random group badges that aren't correct style (<a href="https://habcheer.ca/community" target="_blank">https://habcheer.ca/community</a>)</p><p></p><p>[SPOILER="Click Here"][PHP]<?php</p><p>/*=========================================================+</p><p>|| # Xdr 2013.</p><p>|| # Este es un Software de código libre, libre edición.</p><p>|| # Build: 2500 (R2.5)</p><p>|+=========================================================+</p><p>|| # Based in Jaym/Kreechin.</p><p>|+=========================================================+</p><p>*/</p><p></p><p>$Base = false;</p><p>$Symbols = false;</p><p>$Dir = 'BN';</p><p></p><p>$BaseCode = '';</p><p>$SymbolsCode = [];</p><p></p><p>$_GET = str_replace(['<', '>', '"', '\'', '\\'], ['&lt;', '&gt;', '&quot;', '&#39;', '&#92;'], $_GET);</p><p></p><p>if(isset($_SERVER['HTTP_REFERER']) && (strstr($_SERVER['HTTP_REFERER'], '/groups/') || strstr($_SERVER['HTTP_REFERER'], '/myhabbo/') || strstr($_SERVER['HTTP_REFERER'], '/community'))):</p><p> $Dir = 'BO';</p><p>endif;</p><p></p><p>//Methods</p><p>function GetParts($BasePartCode, $isSymbol = false) {</p><p> $BadgePartCode = [];</p><p></p><p> if(strlen($BasePartCode) == 4 || strlen($BasePartCode) == 5):</p><p> if(!$isSymbol && strlen($BasePartCode) == 5):</p><p> $_Codes = str_split($BasePartCode, 3);</p><p> $__Codes = str_split($_Codes[1], 2);</p><p></p><p> $Codes[0] = $_Codes[0];</p><p> $Codes[1] = $__Codes[0];</p><p> else:</p><p> $Codes = str_split($BasePartCode, 2);</p><p> endif;</p><p> elseif(strlen($BasePartCode) == 6):</p><p> $_Codes = str_split($BasePartCode, 3);</p><p> $__Codes = str_split($_Codes[1], 2);</p><p></p><p> $Codes[0] = $_Codes[0];</p><p> $Codes[1] = $__Codes[0];</p><p> $Codes[2] = $__Codes[1];</p><p> endif;</p><p></p><p> $BadgePartCode[0] = $Codes[0];</p><p></p><p> $Colors = ['01' => '0xff0xd60x01',</p><p> '02' => '0xee0x760x00',</p><p> '03' => '0x840xde0x00',</p><p> '04' => '0x580x9a0x00',</p><p> '05' => '0x500xc10xfb',</p><p> '06' => '0x000x6f0xcf',</p><p> '07' => '0xff0x980xe3',</p><p> '08' => '0xf30x340xbf',</p><p> '09' => '0xff0x2d0x2d',</p><p> '10' => '0xaf0x0a0x0a',</p><p> '11' => '0xff0xff0xff',</p><p> '12' => '0xc00xc00xc0',</p><p> '13' => '0x370x370x37',</p><p> '14' => '0xfb0xe70xac',</p><p> '15' => '0x970x760x41',</p><p> '16' => '0xc20xea0xff',</p><p> '17' => '0xff0xf10x65',</p><p> '18' => '0xaa0xff0x7d',</p><p> '19' => '0x870xe60xc8',</p><p> '20' => '0x980x440xe7',</p><p> '21' => '0xde0xa90xff',</p><p> '22' => '0xff0xb50x79',</p><p> '23' => '0xc30xaa0x6e',</p><p> '24' => '0x7a0x7a0x7a'</p><p> ];</p><p></p><p> $BadgePartCode[1] = (isset($Colors[$Codes[1]])) ? $Colors[$Codes[1]] : '';</p><p> if(isset($Codes[2])) $BadgePartCode[2] = $Codes[2];</p><p></p><p> return $BadgePartCode;</p><p>}</p><p></p><p>function CheckStr($Str, $Space = true) {</p><p> return ($Space) ? preg_match('/^[a-z0-9-\s]*\$/i', $Str) : preg_match('/^[a-z0-9-]*\$/i', $Str);</p><p>}</p><p></p><p>function Colorize($IMG, $RGB) {</p><p> imageTrueColorToPalette($IMG, true, 256);</p><p> $numColors = imageColorsTotal($IMG);</p><p></p><p> for ($x = 0; $x < $numColors; $x++) {</p><p> list($r, $g, $b) = array_values(imageColorsForIndex($IMG, $x));</p><p> $grayscale = ($r + $g + $b) / 3 / 0xff;</p><p> imageColorSet($IMG, $x, $grayscale * $RGB[0], $grayscale * $RGB[1], $grayscale * $RGB[2]);</p><p> }</p><p>}</p><p></p><p>// Security</p><p>if(!isset($_GET['badge']) || CheckStr($_GET['badge']))</p><p> exit;</p><p></p><p>$BadgeCode = str_replace(['.gif', 'X'], '', $_GET['badge']);</p><p>// Cache</p><p>if(file_exists($Dir . '/cache/' . $BadgeCode . '.gif')):</p><p> header('Content-type: image/gif');</p><p> imagegif(imagecreatefromgif($Dir . '/cache/' . $BadgeCode . '.gif'));</p><p> exit;</p><p>endif;</p><p>// Generator</p><p>if(strstr($BadgeCode, 'b'))</p><p> $Base = true;</p><p></p><p>if(strstr($BadgeCode, 's'))</p><p> $Symbols = true;</p><p></p><p>if($Symbols === true):</p><p> $Parts = explode('s', $BadgeCode);</p><p> $BaseCode = str_replace('b', '', $Parts[0]);</p><p></p><p> if(strlen($BaseCode) < 4 && strlen($BaseCode) > 5)</p><p> exit;</p><p></p><p> if(strlen($Parts[1]) >= 4 && strlen($Parts[1]) <= 6)</p><p> $SymbolsCode[0] = $Parts[1];</p><p> if(isset($Parts[2]) && strlen($Parts[2]) >= 4 && strlen($Parts[2]) <= 6)</p><p> $SymbolsCode[1] = $Parts[2];</p><p> if(isset($Parts[3]) && strlen($Parts[3]) >= 4 && strlen($Parts[3]) <= 6)</p><p> $SymbolsCode[2] = $Parts[3];</p><p> if(isset($Parts[4]) && strlen($Parts[4]) >= 4 && strlen($Parts[4]) <= 6):</p><p> $SymbolsCode[3] = $Parts[4];</p><p> endif;</p><p>else:</p><p> $BaseCode = str_replace('b', '', $BadgeCode);</p><p> if(strlen($BaseCode) < 3 || strlen($BaseCode) > 5)</p><p> exit;</p><p>endif;</p><p>$Gif_Base = imagecreatefromgif($Dir . '/base/base.gif');</p><p>$Gif_Symbol = imagecreatefromgif($Dir . '/templates/none.gif');</p><p>//Base</p><p>if($Base):</p><p> $BasePartArray = GetParts($BaseCode);</p><p> $ColourHex = str_split($BasePartArray[1], 4);</p><p></p><p> $BaseIMG = imagecreatefromgif($Dir . '/base/' . $BasePartArray[0] . '.gif');</p><p> $p = (imageSX($Gif_Base) / 2) - (imageSX($BaseIMG) / 2);</p><p> $pp = (imageSY($Gif_Base) / 2) - (imageSY($BaseIMG) / 2);</p><p></p><p> $Image = getimagesize ($Dir . '/base/' . $BasePartArray[0] . '.gif');</p><p></p><p> if(!empty($BasePartArray[1]))</p><p> Colorize($BaseIMG, $ColourHex);</p><p></p><p> if(file_exists($Dir . '/base/' . $BasePartArray[0] . '_' . $BasePartArray[0] . '.gif')):</p><p> $BaseIMG2 = imagecreatefromgif($Dir . '/base/' . $BasePartArray[0] . '_' . $BasePartArray[0] . '.gif');</p><p> imagecopymerge($BaseIMG, $BaseIMG2, 0, 0, 0, 0, $Image[0], $Image[1], 100);</p><p></p><p> imagecopy($Gif_Base, $BaseIMG, $p, $pp, 0, 0, $Image[0], $Image[1]);</p><p> else:</p><p> imagecopy($Gif_Base, $BaseIMG, $p, $pp, 0, 0, $Image[0], $Image[1]);</p><p> endif;</p><p>endif;</p><p>//Symbols</p><p>if($Symbols):</p><p> foreach($SymbolsCode as $SymbolCode) {</p><p> $SymbolPartArray = GetParts($SymbolCode, true);</p><p> if(!file_exists($Dir . '/templates/' . $SymbolPartArray[0] . '.gif'))</p><p> continue;</p><p></p><p> $SymbolIMG = imagecreatefromgif($Dir . '/templates/' . $SymbolPartArray[0] . '.gif');</p><p> $Image = getimagesize ($Dir . '/templates/' . $SymbolPartArray[0] . '.gif');</p><p> $h = $Image[0];</p><p> $w = $Image[1];</p><p></p><p> if(!isset($SymbolPartArray[2]) || $SymbolPartArray[2] < 0 || $SymbolPartArray[2] > 8)</p><p> $Pos = 0;</p><p> else</p><p> $Pos = $SymbolPartArray[2];</p><p></p><p> $p = '0';</p><p> $pp = '0';</p><p> $sSymbolIMG_Width = imageSX($Gif_Base);</p><p> $SymbolIMG_Width = imageSX($SymbolIMG);</p><p> $sSymbolIMG_Height = imageSY($Gif_Base);</p><p> $SymbolIMG_Height = imageSY($SymbolIMG);</p><p></p><p> if($Pos == 0):</p><p> $p = '0';</p><p> $pp = '0';</p><p> elseif($Pos == 1):</p><p> $p = (($sSymbolIMG_Width - $SymbolIMG_Width) / 2);</p><p> $pp = 0;</p><p> elseif ($Pos == 2):</p><p> $p = $sSymbolIMG_Width - $SymbolIMG_Width;</p><p> $pp = 0;</p><p> elseif($Pos == 3):</p><p> $p = 0;</p><p> $pp = ($sSymbolIMG_Height / 2) - ($SymbolIMG_Height / 2);</p><p> elseif($Pos == 4):</p><p> $p = ($sSymbolIMG_Width / 2) - ($SymbolIMG_Width / 2);</p><p> $pp = ($sSymbolIMG_Height / 2) - ($SymbolIMG_Height / 2);</p><p> elseif($Pos == 5):</p><p> $p = $sSymbolIMG_Width - $SymbolIMG_Width;</p><p> $pp = ($sSymbolIMG_Height / 2) - ($SymbolIMG_Height / 2);</p><p> elseif($Pos == 6):</p><p> $p = 0;</p><p> $pp = $sSymbolIMG_Height - $SymbolIMG_Height;</p><p> elseif($Pos == 7):</p><p> $p = (($sSymbolIMG_Width - $SymbolIMG_Width) / 2);</p><p> $pp = $sSymbolIMG_Height - $SymbolIMG_Height;</p><p> elseif($Pos == 8):</p><p> $p = $sSymbolIMG_Width - $SymbolIMG_Width;</p><p> $pp = $sSymbolIMG_Height - $SymbolIMG_Height;</p><p> endif;</p><p></p><p> if(file_exists($Dir . '/templates/' . $SymbolPartArray[0] . '_' . $SymbolPartArray[0] . '.gif')):</p><p> $SymbolIMG2 = imagecreatefromgif($Dir . '/templates/' . $SymbolPartArray[0] . '_' . $SymbolPartArray[0] . '.gif');</p><p></p><p> if(!empty($SymbolPartArray[1]) && $SymbolPartArray[0] != 209 && $SymbolPartArray[0] != 210 && $SymbolPartArray[0] != 211 && $SymbolPartArray[0] != 212)</p><p> Colorize($SymbolIMG, str_split($SymbolPartArray[1], 4));</p><p></p><p> imagecopymerge($SymbolIMG, $SymbolIMG2, 0, 0, 0, 0, $Image[0], $Image[1], 100);</p><p> imagecopy($Gif_Base, $SymbolIMG, $p, $pp, 0, 0, $Image[0], $Image[1]);</p><p> else:</p><p> if(!empty($SymbolPartArray[1]))</p><p> Colorize($SymbolIMG, str_split($SymbolPartArray[1], 4));</p><p></p><p> imagecopy($Gif_Base, $SymbolIMG, $p, $pp, 0, 0, $Image[0], $Image[1]);</p><p> endif;</p><p> }</p><p>endif;</p><p>header('Content-type: image/gif');</p><p>imagegif($Gif_Base, $Dir . '/cache/' . $BadgeCode . '.gif');</p><p>imagegif($Gif_Base);</p><p>?>[/PHP][/SPOILER]</p></blockquote><p></p>
[QUOTE="Detox, post: 335145, member: 596"] Okay so there is my badge.php that is in my current habbo-imaging, but its not creating the group badges in the badge-fill folder nor the cache folder and now I'm getting random group badges that aren't correct style ([URL]https://habcheer.ca/community[/URL]) [SPOILER="Click Here"][PHP]<?php /*=========================================================+ || # Xdr 2013. || # Este es un Software de código libre, libre edición. || # Build: 2500 (R2.5) |+=========================================================+ || # Based in Jaym/Kreechin. |+=========================================================+ */ $Base = false; $Symbols = false; $Dir = 'BN'; $BaseCode = ''; $SymbolsCode = []; $_GET = str_replace(['<', '>', '"', '\'', '\\'], ['<', '>', '"', ''', '\'], $_GET); if(isset($_SERVER['HTTP_REFERER']) && (strstr($_SERVER['HTTP_REFERER'], '/groups/') || strstr($_SERVER['HTTP_REFERER'], '/myhabbo/') || strstr($_SERVER['HTTP_REFERER'], '/community'))): $Dir = 'BO'; endif; //Methods function GetParts($BasePartCode, $isSymbol = false) { $BadgePartCode = []; if(strlen($BasePartCode) == 4 || strlen($BasePartCode) == 5): if(!$isSymbol && strlen($BasePartCode) == 5): $_Codes = str_split($BasePartCode, 3); $__Codes = str_split($_Codes[1], 2); $Codes[0] = $_Codes[0]; $Codes[1] = $__Codes[0]; else: $Codes = str_split($BasePartCode, 2); endif; elseif(strlen($BasePartCode) == 6): $_Codes = str_split($BasePartCode, 3); $__Codes = str_split($_Codes[1], 2); $Codes[0] = $_Codes[0]; $Codes[1] = $__Codes[0]; $Codes[2] = $__Codes[1]; endif; $BadgePartCode[0] = $Codes[0]; $Colors = ['01' => '0xff0xd60x01', '02' => '0xee0x760x00', '03' => '0x840xde0x00', '04' => '0x580x9a0x00', '05' => '0x500xc10xfb', '06' => '0x000x6f0xcf', '07' => '0xff0x980xe3', '08' => '0xf30x340xbf', '09' => '0xff0x2d0x2d', '10' => '0xaf0x0a0x0a', '11' => '0xff0xff0xff', '12' => '0xc00xc00xc0', '13' => '0x370x370x37', '14' => '0xfb0xe70xac', '15' => '0x970x760x41', '16' => '0xc20xea0xff', '17' => '0xff0xf10x65', '18' => '0xaa0xff0x7d', '19' => '0x870xe60xc8', '20' => '0x980x440xe7', '21' => '0xde0xa90xff', '22' => '0xff0xb50x79', '23' => '0xc30xaa0x6e', '24' => '0x7a0x7a0x7a' ]; $BadgePartCode[1] = (isset($Colors[$Codes[1]])) ? $Colors[$Codes[1]] : ''; if(isset($Codes[2])) $BadgePartCode[2] = $Codes[2]; return $BadgePartCode; } function CheckStr($Str, $Space = true) { return ($Space) ? preg_match('/^[a-z0-9-\s]*\$/i', $Str) : preg_match('/^[a-z0-9-]*\$/i', $Str); } function Colorize($IMG, $RGB) { imageTrueColorToPalette($IMG, true, 256); $numColors = imageColorsTotal($IMG); for ($x = 0; $x < $numColors; $x++) { list($r, $g, $b) = array_values(imageColorsForIndex($IMG, $x)); $grayscale = ($r + $g + $b) / 3 / 0xff; imageColorSet($IMG, $x, $grayscale * $RGB[0], $grayscale * $RGB[1], $grayscale * $RGB[2]); } } // Security if(!isset($_GET['badge']) || CheckStr($_GET['badge'])) exit; $BadgeCode = str_replace(['.gif', 'X'], '', $_GET['badge']); // Cache if(file_exists($Dir . '/cache/' . $BadgeCode . '.gif')): header('Content-type: image/gif'); imagegif(imagecreatefromgif($Dir . '/cache/' . $BadgeCode . '.gif')); exit; endif; // Generator if(strstr($BadgeCode, 'b')) $Base = true; if(strstr($BadgeCode, 's')) $Symbols = true; if($Symbols === true): $Parts = explode('s', $BadgeCode); $BaseCode = str_replace('b', '', $Parts[0]); if(strlen($BaseCode) < 4 && strlen($BaseCode) > 5) exit; if(strlen($Parts[1]) >= 4 && strlen($Parts[1]) <= 6) $SymbolsCode[0] = $Parts[1]; if(isset($Parts[2]) && strlen($Parts[2]) >= 4 && strlen($Parts[2]) <= 6) $SymbolsCode[1] = $Parts[2]; if(isset($Parts[3]) && strlen($Parts[3]) >= 4 && strlen($Parts[3]) <= 6) $SymbolsCode[2] = $Parts[3]; if(isset($Parts[4]) && strlen($Parts[4]) >= 4 && strlen($Parts[4]) <= 6): $SymbolsCode[3] = $Parts[4]; endif; else: $BaseCode = str_replace('b', '', $BadgeCode); if(strlen($BaseCode) < 3 || strlen($BaseCode) > 5) exit; endif; $Gif_Base = imagecreatefromgif($Dir . '/base/base.gif'); $Gif_Symbol = imagecreatefromgif($Dir . '/templates/none.gif'); //Base if($Base): $BasePartArray = GetParts($BaseCode); $ColourHex = str_split($BasePartArray[1], 4); $BaseIMG = imagecreatefromgif($Dir . '/base/' . $BasePartArray[0] . '.gif'); $p = (imageSX($Gif_Base) / 2) - (imageSX($BaseIMG) / 2); $pp = (imageSY($Gif_Base) / 2) - (imageSY($BaseIMG) / 2); $Image = getimagesize ($Dir . '/base/' . $BasePartArray[0] . '.gif'); if(!empty($BasePartArray[1])) Colorize($BaseIMG, $ColourHex); if(file_exists($Dir . '/base/' . $BasePartArray[0] . '_' . $BasePartArray[0] . '.gif')): $BaseIMG2 = imagecreatefromgif($Dir . '/base/' . $BasePartArray[0] . '_' . $BasePartArray[0] . '.gif'); imagecopymerge($BaseIMG, $BaseIMG2, 0, 0, 0, 0, $Image[0], $Image[1], 100); imagecopy($Gif_Base, $BaseIMG, $p, $pp, 0, 0, $Image[0], $Image[1]); else: imagecopy($Gif_Base, $BaseIMG, $p, $pp, 0, 0, $Image[0], $Image[1]); endif; endif; //Symbols if($Symbols): foreach($SymbolsCode as $SymbolCode) { $SymbolPartArray = GetParts($SymbolCode, true); if(!file_exists($Dir . '/templates/' . $SymbolPartArray[0] . '.gif')) continue; $SymbolIMG = imagecreatefromgif($Dir . '/templates/' . $SymbolPartArray[0] . '.gif'); $Image = getimagesize ($Dir . '/templates/' . $SymbolPartArray[0] . '.gif'); $h = $Image[0]; $w = $Image[1]; if(!isset($SymbolPartArray[2]) || $SymbolPartArray[2] < 0 || $SymbolPartArray[2] > 8) $Pos = 0; else $Pos = $SymbolPartArray[2]; $p = '0'; $pp = '0'; $sSymbolIMG_Width = imageSX($Gif_Base); $SymbolIMG_Width = imageSX($SymbolIMG); $sSymbolIMG_Height = imageSY($Gif_Base); $SymbolIMG_Height = imageSY($SymbolIMG); if($Pos == 0): $p = '0'; $pp = '0'; elseif($Pos == 1): $p = (($sSymbolIMG_Width - $SymbolIMG_Width) / 2); $pp = 0; elseif ($Pos == 2): $p = $sSymbolIMG_Width - $SymbolIMG_Width; $pp = 0; elseif($Pos == 3): $p = 0; $pp = ($sSymbolIMG_Height / 2) - ($SymbolIMG_Height / 2); elseif($Pos == 4): $p = ($sSymbolIMG_Width / 2) - ($SymbolIMG_Width / 2); $pp = ($sSymbolIMG_Height / 2) - ($SymbolIMG_Height / 2); elseif($Pos == 5): $p = $sSymbolIMG_Width - $SymbolIMG_Width; $pp = ($sSymbolIMG_Height / 2) - ($SymbolIMG_Height / 2); elseif($Pos == 6): $p = 0; $pp = $sSymbolIMG_Height - $SymbolIMG_Height; elseif($Pos == 7): $p = (($sSymbolIMG_Width - $SymbolIMG_Width) / 2); $pp = $sSymbolIMG_Height - $SymbolIMG_Height; elseif($Pos == 8): $p = $sSymbolIMG_Width - $SymbolIMG_Width; $pp = $sSymbolIMG_Height - $SymbolIMG_Height; endif; if(file_exists($Dir . '/templates/' . $SymbolPartArray[0] . '_' . $SymbolPartArray[0] . '.gif')): $SymbolIMG2 = imagecreatefromgif($Dir . '/templates/' . $SymbolPartArray[0] . '_' . $SymbolPartArray[0] . '.gif'); if(!empty($SymbolPartArray[1]) && $SymbolPartArray[0] != 209 && $SymbolPartArray[0] != 210 && $SymbolPartArray[0] != 211 && $SymbolPartArray[0] != 212) Colorize($SymbolIMG, str_split($SymbolPartArray[1], 4)); imagecopymerge($SymbolIMG, $SymbolIMG2, 0, 0, 0, 0, $Image[0], $Image[1], 100); imagecopy($Gif_Base, $SymbolIMG, $p, $pp, 0, 0, $Image[0], $Image[1]); else: if(!empty($SymbolPartArray[1])) Colorize($SymbolIMG, str_split($SymbolPartArray[1], 4)); imagecopy($Gif_Base, $SymbolIMG, $p, $pp, 0, 0, $Image[0], $Image[1]); endif; } endif; header('Content-type: image/gif'); imagegif($Gif_Base, $Dir . '/cache/' . $BadgeCode . '.gif'); imagegif($Gif_Base); ?>[/PHP][/SPOILER] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
habbo-imaging badge.php
Top