Advertisement
michaelyuen

Untitled

May 21st, 2017
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2. // Set the content-type
  3. header('Content-Type: image/png');
  4.  
  5. // Create the image
  6. $im = imagecreatetruecolor(400, 30);
  7.  
  8. // Create some colors
  9. $white = imagecolorallocate($im, 255, 255, 255);
  10. $grey = imagecolorallocate($im, 128, 128, 128);
  11. $black = imagecolorallocate($im, 0, 0, 0);
  12. imagefilledrectangle($im, 0, 0, 399, 29, $white);
  13.  
  14. // The text to draw
  15. $email = 'example@example.com';
  16. $text = $email;
  17. // Replace path by your own font path
  18. $font = 'arial.ttf';
  19.  
  20. // Add some shadow to the text
  21. imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
  22.  
  23. // Add the text
  24. imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
  25.  
  26. // Using imagepng() results in clearer text compared with imagejpeg()
  27. imagepng($im);
  28. imagedestroy($im);
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement