Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(E_ALL);
  4. putenv('GDFONTPATH=' . realpath('.'));
  5. $name = $_GET['name'];
  6.  
  7. $content = file_get_contents('http://api.ls-rp.net/char/'.$name);
  8.  
  9. if($content) {
  10.     $content = json_decode($content);
  11.  
  12.     if(isset($content->success)) {
  13.         header('Content-type: image/png');
  14.         $jpg_image = imagecreatefrompng('test.png');
  15.        
  16.         $white = imagecolorallocate($jpg_image, 0, 255, 0);
  17.         $black = imagecolorallocatealpha($jpg_image, 0, 0, 0, 64);
  18.        
  19.         imagefilledrectangle($jpg_image, 40, 25, 300, 75, $black);
  20.         imagettftext($jpg_image, 20, 0, 50, 60, $white, 'Hero.otf', $content->data->char->name);
  21.        
  22.         imagefilledrectangle($jpg_image, 360, 25, 500, 75, $black);
  23.         imagettftext($jpg_image, 20, 0, 380, 60, $white, 'Hero.otf', $content->data->char->hours.":".sprintf("%02d", $content->data->char->minutes)."h. ");
  24.  
  25.         imagepng($jpg_image);
  26.         imagedestroy($jpg_image);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement