daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 59 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. How to create an image with transparent background
  2. header('content-type: image/png');
  3.  
  4. $image = imagecreatetruecolor(900, 350);
  5.  
  6. imagealphablending($image, true);
  7. imagesavealpha($image, true);
  8.  
  9. $text_color = imagecolorallocate($image, 0, 51, 102);
  10. imagestring($image,2,4,4,'Test',$text_color);
  11.  
  12. imagepng($image);
  13. imagedestroy($image);
  14.    
  15. imagefill($image,0,0,0x7fff0000);
  16.    
  17. alpha = 0x7f
  18. red = 0xff
  19. green = 0x00
  20. blue = 0x00
  21.    
  22. $im = @imagecreatetruecolor(100, 25);
  23. # important part one
  24. imagesavealpha($im, true);
  25. imagealphablending($im, false);
  26. # important part two
  27. $white = imagecolorallocatealpha($im, 255, 255, 255, 127);
  28. imagefill($im, 0, 0, $white);
  29. # do whatever you want with transparent image
  30. $lime = imagecolorallocate($im, 204, 255, 51);
  31. imagettftext($im, $font, 0, 0, $font - 3, $lime, "captcha.ttf", $string);
  32. header("Content-type: image/png");
  33. imagepng($im);
  34. imagedestroy($im);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top