Coder Social home page Coder Social logo

games647 / minecraft-banner-generator Goto Github PK

View Code? Open in Web Editor NEW
7.0 5.0 10.0 1.91 MB

Minecraft banner generator library

Home Page: https://packagist.org/packages/games647/minecraft-banner-generator

License: MIT License

PHP 100.00%
minecraft minecraft-banner flexible php ping easy

minecraft-banner-generator's Introduction

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:

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

//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);

Backgrounds

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]");

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

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

Minecraft banner


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

Minecraft banner


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

Minecraft banner


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

Minecraft banner

minecraft-banner-generator's People

Contributors

br3uxi avatar games647 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

minecraft-banner-generator's Issues

ImageMagick Support?

Hi,

first of all: Thanks for this project, it's really helpful.

While being not available in any platform, ImageMagick is way more faster and more efficient than gD-Lib, so it would be awesome to have this library supporting the php extension. If you're open for this, I could make a pull request which supports the image-creator extension.

Cheers

Does this even work Dynamically?

I think I've tried for like 4 hours now to try and get this to work and it just doesn't work. It could be because I'm extremely tired and I've ran out of coffee, but I'm just flabbergasted atm. I can't see where the $address variable is gotten from, I tried to integrate MinecraftServerStatus by addings it's src files then adding it as a require, with and without for testing. I've tried changing $address to $host for kicks and giggles since that's what MinecraftServerStatus uses. I can't see where in any of your files it actually reaches for a handshake with the server. The only thing that actually seems like it does work, is that php is generating a banner with text on it, in the form of a png. Which is nice and all, but the main purpose of a banner like this would be to display dynamically the player count, along with any of the other information from the server. Which in the example it doesn't do, and without proper documentation, I can't figure out how to actually get this darn thing to work and or where to even find the handshake to sort out how it works.

Now I'm not saying this repo sucks, because it's actually some brilliant coding to create a png from php with a lot of interesting options. But the main purpose of the generator doesn't work, or the documentation is insufficient enough to cause me a migraine lol.

Still man, it's leaps and bounds then what I've been able to accomplish on my own in the past. I tried to accomplish the same thing and failed miserably. So I might just rewrite some of this tomorrow and see if I can't add in those functions to work dynamically. I'll have to rewrite some of it though and was hoping by placing an issue, I may have just been stupid myself and missed something.

In any case, cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.