[Web] MinecraftImage - easy server status images

Discussion in 'Bukkit Tools' started by Benni1000, Sep 8, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Benni1000

    What is MinecraftImage?
    MinecraftImage is a PHP script that allows you to display the status of your minecraft server on an image.
    The script can display:
    • Your custom text (full minecraft color support)
    • How many players are online
    • Your MOTD
    • How many slots your server has
    • and more...
    The script is extremely easy to configure and you need *NO* programming experience to configure it.
    You can generate an unlimited amount of images (for an unlimited amount of minecraft servers) using the script, and you only need the script once. When you want to add a new image simply add it in the config.yml file.
    The images are cached (configurable) to save resources.

    Installation:
    The installation is really simple, all you need is a webserver with php5, php5-gd and php socket connections enabled (this is often disabled by hosting providers). If the script does not work on your system please make sure that you fulfill the following requirements:
    • Your minecraft server has "enable-query" set to true
    • Your webserver has the php GD extension installed
    • PHP is allowed to open sockets
    • The source-image that you provided in the configuration file is readable
    • The font that you configured in the configuration file is readable
    Configuration:
    The script folder contains a well documented configuration file named 'config.yml'.

    Insert new fonts or source-images:
    When you add a new image or a new font file you can place it in any directory that is readable by your webserver, but it is recommended that you place your source-images in the image and your TTF fonts in your fonts folder. You can only use "TTF" fonts, and jpg, png or gif image files.

    Using the generated images in your signature of website:
    When you want to use a generated image, you have to specify your script as the image source.
    For example if you want to display the example image that is configured in the config.yml file you would choose this image source: http://yourpage.tld/minecraftImage/index.php?server=mainserver

    Download:
    http://benni1000.eu/scripts/minecraftImage.zip

    License:
    Code:
    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
     
    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
     
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
     
    meso, DONalex, Goblom and 1 other person like this.
  2. Offline

    NathanG_

  3. Offline

    Benni1000

    Example pictures are kind of pointless, because you can customize everything.
    The Font, the color, the text and the base image that the text is drawn on are all customizable.
     
  4. Offline

    Benni1000

    A new version is out:
    • All classes are now PSR-0 compatible and loaded using the composer PSR-0 autoloader
     
  5. Offline

    EvilTelephone

    I tried using this, but I get the following error:

    Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /mineimage/index.php on line 14

    EDIT: I'm on PHP5.3
     
  6. Offline

    Benni1000

    That is very strange, are you sure that you are running PHP version 5.3?
    It seems like your PHP version does not support namespaces.
     
  7. Offline

    EvilTelephone

    Yes, I double-checked and it's most definitely 5.3. Maybe there's some odd PHP configuration that's not compatible with your application. This is the first time that I've run in to PHP issues though and I run several other PHP-heavy sites on the same server. Odd.
     
  8. Offline

    Benni1000

    I think I know why it isn't working.
    Composer (the script that is used to autoload all the used classes) requires at least PHP 5.3.2.
    There were some namespace related fixes in 5.3.2 and 5.3.1 maybe composer needs those bugfixes to operate.
     
  9. Offline

    Laekh

    This looks really interesting, I'll check it out when I get home.
    Good job.
     
  10. Offline

    JOPHESTUS

    Maybe you could show examples of this. So people can see how customisable it is
     
  11. Offline

    Benni1000


    If you can send me a minecraft Server that is willing to be the target of that test-image sure, I am willing to do that.

    Are you guys still interested in the script? If you are interested I could add caching support and maybe even
    add support for the new Serverlist image that being displayed in the minecraft client serverlist.
     
  12. Offline

    seriosbrad

    Good script, I like it a lot.

    Here are a couple of examples

    Online
    [​IMG]

    Offline
    [​IMG]

    You should add support for parsing Minecraft color codes, as well as some general text formatting options like bold, italic, perhaps some text-shadowing effects. :)

    Note: Message of the Day is generally referred to as MOTD, not MODT ;)
     
  13. Offline

    Benni1000


    A new Version is out:
    • All classes are now loaded using the composer PSR-4 autoloader
    • You can now specify how long an image should be cached before it is generated again
    • Minecraft color codes are now supported (if you use § you can use them in any string)
    • Fixed MOTD typo, you can however (legacy reasons) use MODT
     
  14. Offline

    seriosbrad

    Nice job so far!

    It seems that in this version, it doesn't parse the %game_type% and the second line of the MOTD doesn't break to the next line

    example:
    [​IMG]

    The "Find us at:......" should be on the next line
     
  15. Offline

    Benni1000

    Oh totally forgot to mention that, I use a new Ping library which does not extract the gametype anymore
    so that setting is gone.
    And I fixed the newline bug, just download the script again and it should work.
     
  16. Offline

    thapengwin

    There's a bug in the caching. While your script only rewrites the image file, the cache software you use looks for it's creation time, but it should be looking for modification time. I fixed this by changing
    PHP:
    filectime($cacheFile);
    to
    PHP:
    filemtime($cacheFile);
    on line 159 in the Cache.php file.
    Also, you should consider adding
    PHP:
    error_reporting(E_ERROR);
    to your scripts as, when a warning is issued on some installations (WAMP is seriously affected by this), the image will contain raw HTML - and this means if your server's offline, your image will not work.
    Please fix these issues to not cause annoyance to others as it did to me for quite a while.

    EDIT: I've also found a bug whereas your config file says that adding the .ttf extension isn't required, it actually is.

    EDIT 2 (darn do you have bugs in your code): Images, or at least PNG, don't have alpha layers once they are rendered. Fix this by adding
    PHP:
    imagealphablending($imagetrue);
    imageSaveAlpha($imagetrue);
    AFTER you create the image.
     
Thread Status:
Not open for further replies.

Share This Page