Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- putenv('GDFONTPATH=' . realpath('.'));
- $name = $_GET['name'];
- $content = file_get_contents('http://api.ls-rp.net/char/'.$name);
- if($content) {
- $content = json_decode($content);
- if(isset($content->success)) {
- header('Content-type: image/png');
- $jpg_image = imagecreatefrompng('test.png');
- $white = imagecolorallocate($jpg_image, 0, 255, 0);
- $black = imagecolorallocatealpha($jpg_image, 0, 0, 0, 64);
- imagefilledrectangle($jpg_image, 40, 25, 300, 75, $black);
- imagettftext($jpg_image, 20, 0, 50, 60, $white, 'Hero.otf', $content->data->char->name);
- imagefilledrectangle($jpg_image, 360, 25, 500, 75, $black);
- imagettftext($jpg_image, 20, 0, 380, 60, $white, 'Hero.otf', $content->data->char->hours.":".sprintf("%02d", $content->data->char->minutes)."h. ");
- imagepng($jpg_image);
- imagedestroy($jpg_image);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement