Renderer code (Work in progress)

Draft for 'backend/render.php'.

Made some directory changes
This commit is contained in:
Victor Westerlund 2020-11-17 06:23:16 +01:00
parent ed7cd2077b
commit 293ee0a247
15 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,44 @@
<?php
class Layer {
public function __construct($file) {
$this->image = imagecreatefrompng($file);
$this->size = list($width,$height,$type,$attr) = getimagesize($file);
}
}
class Main {
private $serversDir = "./servers/";
public function __construct() {
$this->config = $this->importConfig();
$this->init();
}
private function importConfig() {
$server = $_GET["server"];
$config = $serversDir."config.json";
if(!file_exists($config)) {
throw new Exception(["400","Server not in config"]);
}
return json_decode(file_get_contents($config));
}
function init() {
$bg = new Layer("background.png");
# Prepare final image
$cape = imagecreatetruecolor($bg->size[0],$bg->size[1]);
imagealphablending($cape,true);
imagesavealpha($cape,true);
}
}
new Main();

View file

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 713 B

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

Before

Width:  |  Height:  |  Size: 7 KiB

After

Width:  |  Height:  |  Size: 7 KiB

View file

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB