corrade-http-templates
/downloadTexture/downloadTexture.php |
@@ -7,44 +7,22 @@ |
## and the "download" Corrde command. ## |
########################################################################### |
|
if(!isset($_POST['uuid'])) return; |
|
$uuid = $_POST['uuid']; |
|
########################################################################### |
## CONFIGURATION ## |
########################################################################### |
|
# Set this to the name of the group. |
$GROUP = 'My Group'; |
# Set this to the group password. |
$PASSWORD = 'mypassword'; |
# Set this to Corrade's HTTP Server URL. |
$URL = 'http://corrade.hostname:8080'; |
require_once('config.php'); |
require_once('functions.php'); |
|
########################################################################### |
## INTERNALS ## |
########################################################################### |
|
########################################################################### |
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
########################################################################### |
function wasKeyValueGet($key, $data) { |
return array_reduce( |
explode( |
"&", |
$data |
), |
function($o, $p) { |
$x = explode("=", $p); |
return array_shift($x) != $o ? $o : array_shift($x); |
}, |
$key |
); |
} |
if(!isset($_POST['uuid'])) return; |
$uuid = $_POST['uuid']; |
|
#### |
# II. Download the map image as a PNG file. |
# I. Download the map image as a PNG file. |
$params = array( |
'command' => 'download', |
'group' => $GROUP, |
@@ -88,7 +66,7 @@ |
} |
|
#### |
# III. Convert the image data to a PNG of size 512x512 |
# II. Convert the image data to a PNG of size 512x512 |
$im = imagescale( |
imagecreatefromstring( |
base64_decode( |
@@ -105,7 +83,7 @@ |
); |
|
#### |
# IV. Output the Base64 encoded image for AJAX. |
# III. Output the Base64 encoded image for AJAX. |
ob_start(); |
imagepng($im); |
$png = ob_get_contents(); |