Esempio n. 1
0
<?php

require 'smo_lib.php';
$smo_id = NULL;
if (php_sapi_name() === 'cli') {
    if (!isset($argv[1]) || !is_numeric($argv[1])) {
        die('please provide a smo_id');
    } else {
        $smo_id = $argv[1];
    }
} else {
    if (empty($_GET['smo_id']) || !is_numeric($_GET['smo_id'])) {
        die('please provide a smo_id');
    } else {
        $smo_id = $_GET['smo_id'];
    }
}
echo json_encode(get_smo_stats($smo_id));
Esempio n. 2
0
<?php

require 'smo_lib.php';
if (!isset($_GET['smo_id'])) {
    die('please provide a smo_id');
}
$data = get_smo_stats($_GET['smo_id']);
header('Content-Type: image/png;');
$im = @imagecreatefrompng('img/background.png');
$text_color = imagecolorallocate($im, 255, 255, 255);
// RED, GREEN, BLUE --> Go to www.colorpicker.com, select a nice color, copy the R/G/B letters provided by colorpicker and put them here.
$font = __DIR__ . '/opensans.ttf';
//Upload your custom font to the directory where this file is placed. Then change the name here.
/* USAGE OF THE imagettftext: First ($im) shouldn't be changed. (16) is the text-size. (0) is the angle of your text. Change it, and you'll see what's going on. (20) is de X-coordinate of the text.
(36) is the Y-coordinate of the text. */
$profile = @imagecreatefrompng($data['profile-img']);
imagecopyresampled($im, $profile, 0, 0, 0, 0, 100, 100, 150, 150);
imagettftext($im, 16, 0, 115, 20, $text_color, $font, $data['username']);
// Prints the username in the picture.
imagettftext($im, 16, 0, 115, 40, $text_color, $font, "Level: " . $data['level']);
// Prints the score in the picture.
imagettftext($im, 16, 0, 115, 60, $text_color, $font, "Rank: " . $data['rank']);
imagettftext($im, 16, 0, 115, 90, $text_color, $font, "StepmaniaOnline profile");
imagepng($im);
imagedestroy($im);