Advertisement
Guest User

Untitled

a guest
Apr 5th, 2014
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * IDK Script by Steve Winfield
  5.  * Cuts off the head of a habbo avatar
  6. **/
  7. header('Content-Type: image/png');
  8.  
  9. if (!isset($_GET['figure']))
  10.     $_GET['figure'] = 'hr-165-45.hd-208-2.ch-250-64.lg-285-82.sh-290-64,s-0.g-0.d-4.h-4.a-0';
  11.  
  12. $params = '';
  13.  
  14. foreach($_GET as $k => $v)
  15.     $params .= '&'.$k.'='.$v;
  16.  
  17. $hashcheck = md5('avatar_'.$params);
  18.  
  19. if (file_exists('./cache/'.$hashcheck.'.png'))
  20.     exit(file_get_contents('./cache/'.$hashcheck.'.png'));
  21.  
  22. $faceline = array(
  23.     50 => array(54, 0),
  24.     49 => array(54, 0),
  25.     48 => array(28, 33),
  26.     47 => array(26, 35),
  27.     46 => array(25, 36),
  28.     45 => array(24, 37),
  29.     44 => array(23, 54),
  30.     43 => array(22, 54)
  31. );
  32.  
  33. $source = imagecreatefrompng('http://www.habbo.de/habbo-imaging/avatarimage?'.substr($params, 1));
  34. $img    = imagecreate(54, 65);
  35. $trans  = imagecolortransparent($img, imagecolorallocate($img, 0, 0, 0));
  36.  
  37. imagecopy($img, $source, 0, 0, 6, 8, 54, 51);
  38.  
  39. for ($x = 0; $x < 54; $x++) {
  40.     for ($y = 0; $y < 65; $y++) {
  41.         if (isset($faceline[$y]) && ($x < $faceline[$y][0] || $x > $faceline[$y][1]))
  42.             imagesetpixel($img, $x, $y, $trans);
  43.     }
  44. }
  45.  
  46. ob_start();
  47. imagepng($img);
  48. file_put_contents('./cache/'.$hashcheck.'.png', ob_get_contents());
  49.  
  50. imagedestroy($img);
  51. imagedestroy($source);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement