Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. ini_set('display_errors', '1');
  4.  
  5.  
  6. $codigo = $_GET['code'];
  7.  
  8.  
  9. $codigo = str_replace(" ","+",$codigo);
  10.  
  11. $data = base64_decode($codigo);
  12.  
  13. $image_s = imagecreatefromstring($data);
  14.  
  15.  
  16.  
  17.  
  18.  
  19. $width = imagesx($image_s);
  20. $height = imagesy($image_s);
  21.  
  22.  
  23. $newwidth = 285;
  24. $newheight = 232;
  25.  
  26. $image = imagecreatetruecolor($newwidth, $newheight);
  27. $blanco = imagecolorallocate($image, 255, 255, 255);
  28. imagealphablending($image,true);
  29. imagecopyresampled($image,$image_s,0,0,0,0,$newwidth,$newheight,$width,$height);
  30.  
  31. // create masking
  32. $mask = imagecreatetruecolor($width, $height);
  33. $mask = imagecreatetruecolor($newwidth, $newheight);
  34.  
  35.  
  36.  
  37. $transparent = imagecolorallocate($mask, 255, 0, 0);
  38. imagecolortransparent($mask, $transparent);
  39.  
  40.  
  41.  
  42. imagefilledellipse($mask, $newwidth/2, $newheight/2, $newwidth, $newheight, $transparent);
  43.  
  44.  
  45.  
  46. $red = imagecolorallocate($mask, 0, 0, 0);
  47. imagecopymerge($image, $mask, 0, 0, 0, 0, $newwidth, $newheight,100);
  48. imagecolortransparent($image, $red);
  49. imagefill($image,0,0, $blanco);
  50.  
  51. // output and free memory
  52. header('Content-type: image/png');
  53. imagepng($image);
  54. imagedestroy($image);
  55. imagedestroy($mask);
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement