项目作者: games647

项目描述 :
Minecraft banner generator library
高级语言: PHP
项目地址: git://github.com/games647/Minecraft-Banner-Generator.git
创建时间: 2016-05-18T15:11:41Z
项目社区:https://github.com/games647/Minecraft-Banner-Generator

开源协议:MIT License

下载


Minecraft Banner Generator

Description

Minecraft banner generator library.

Features

  • Server banner
    Displays:
    • Ping (shows different about how good the ping is)
    • Online players
    • Max players
    • Favicon if available
    • Colorized motd (message of the day)
    • Custom background
  • Player banners
    Displays:
    • Player Head image
    • Displays player name
  • No branding
  • No Magic values
  • Free

ToDo

  • Text style effects (bold, italic, underlined)
  • Automatic line wrapping
  • Graph of player activity

Installation

With composer it’s just:

  1. 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.

Usage

  1. //this is only used if you don't use composer
  2. require __DIR__ . '/PATH_TO_LIB_FOLDER/MinecraftBanner.php';
  3. require __DIR__ . '/PATH_TO_LIB_FOLDER/ServerBanner.php';
  4. use \MinecraftBanner\ServerBanner;
  5. use \MinecraftBanner\MinecraftBanner;
  6. [...]
  7. //tell the browser that we will send the raw image without HTML
  8. header('Content-type: image/png');
  9. $banner = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt");
  10. imagepng($banner);

Backgrounds

You can use 11 build in Backgrounds or Images as files or URLs

  1. $favicon = imagecreatefrompng("server_favicon.png");
  2. $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]");

CLOUDS_BACKGROUND

CLOUDS_BACKGROUND

LILLY_PADS_BACKGROUND

LILLY_PADS_BACKGROUND

HILLS_BACKGROUND

HILLS_BACKGROUND

WATERFALL_BACKGROUND

WATERFALL_BACKGROUND

CANYON_BACKGROUND

CANYON_BACKGROUND

GRASSLAND_BACKGROUND

GRASSLAND_BACKGROUND

GRASSLAND_CANYON_BACKGROUND

GRASSLAND_CANYON_BACKGROUND

SWAMP_BACKGROUND

SWAMP_BACKGROUND

LAKE_BACKGROUND

LAKE_BACKGROUND

SWAMP2_BACKGROUND

SWAMP2_BACKGROUND

LILLY_PADS_SWAMP_BACKGROUND

LILLY_PADS_SWAMP_BACKGROUND

Scaling

Scaling

Examples

  1. $favicon = imagecreatefrompng("server_favicon.png");
  2. $image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon);

Minecraft banner


  1. $favicon = imagecreatefrompng("notch_head.png");
  2. $image = PlayerBanner::player("Notch", $favicon);

Minecraft banner


  1. $favicon = imagecreatefrompng("server_favicon.png");
  2. $image = ServerBanner::server("example.minecraft.com", "§aHallo §cWelt", -1, -1, $favicon, MinecraftBanner::LILLY_PADS_BACKGROUND);

Minecraft banner


  1. $favicon = imagecreatefrompng("notch_head.png");
  2. $image = PlayerBanner::player("Notch", $favicon, MinecraftBanner::LILLY_PADS_BACKGROUND);

Minecraft banner