Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. renderCaptcha($code: 'test');
  3.  
  4. function renderCaptcha($code){
  5.     $im = imagecreatetruecolor(width: 300, height: 300);
  6.     //RGB
  7.     $backColor = imagecolorallocate(image: $im, red: 255, green: 224, blue: 221);
  8.     $textColor = imagecolorallocate(image: $im, red: 129, green: 15, blue: 90);
  9.     $fontFile = '/font/OpenSans-Regular.ttf';
  10.     $imBox = imagecreatefrompng(filename: '/font/bmw_PNG1709.png')
  11.     imagefill($image: $im, x:0, y:0, color: $backColor);
  12.     imagecopy(dst_im: $im, src_im: $imBox, dst_x: 10, dst_y: 10, src_x: 0, src_y: 0, src_w: 256, src_h: 256);
  13.     imagettftext(image: $im, size: 25, angle: 0, x: 30, y: 30, color: $textColor, fontFile: $fontFile, text: $code);
  14.     imagepng($im);
  15.     imagedestroy($im);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement