Minecraft banner generator library
Minecraft banner generator library.
With composer it’s just:
composer require games647/minecraft-banner-generator
For non-composer projects, you can drop the files from the /src folder into a libraries folder and use it with a
require statement at the top of the PHP-File. You can see a example in the example.php file.
//this is only used if you don't use composer
require __DIR__ . '/PATH_TO_LIB_FOLDER/MinecraftBanner.php';
require __DIR__ . '/PATH_TO_LIB_FOLDER/ServerBanner.php';
use \MinecraftBanner\ServerBanner;
use \MinecraftBanner\MinecraftBanner;
[...]
//tell the browser that we will send the raw image without HTML
header('Content-type: image/png');
$banner = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt");
imagepng($banner);
You can use 11 build in Backgrounds or Images as files or URLs
$favicon = imagecreatefrompng("server_favicon.png");
$image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon, "MinecraftBanner::[DEFAULT_BACKGROUND, CLOUDS_BACKGROUND, LILLY_PADS_BACKGROUND, HILLS_BACKGROUND, WATERFALL_BACKGROUND, CANYON_BACKGROUND, GRASSLAND_BACKGROUND, GRASSLAND_CANYON_BACKGROUND, SWAMP_BACKGROUND, LAKE_BACKGROUND, SWAMP2_BACKGROUND, LILLY_PADS_SWAMP_BACKGROUND]");
$favicon = imagecreatefrompng("server_favicon.png");
$image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon);
$favicon = imagecreatefrompng("notch_head.png");
$image = PlayerBanner::player("Notch", $favicon);
$favicon = imagecreatefrompng("server_favicon.png");
$image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon, MinecraftBanner::LILLY_PADS_BACKGROUND);
$favicon = imagecreatefrompng("notch_head.png");
$image = PlayerBanner::player("Notch", $favicon, MinecraftBanner::LILLY_PADS_BACKGROUND);