mcstat icon indicating copy to clipboard operation
mcstat copied to clipboard

Favicon support ?

Open Pringui opened this issue 9 years ago • 1 comments

Hi, I'm not sure if this API is still being updated, if it is, can you add a favicon (server-icon) support or explain me how to do it. It would help me a lot, thank you.

Pringui avatar Aug 05 '16 21:08 Pringui

Currently mcstat supports two styles of server list ping -- legacy (pre-1.7) and 1.7 (and greater). To use the 1.7 server list ping, pass true to MinecraftStatus::ping(). The image is presented as a data uri and available at $reply['json']['favicon']. I think most php functions that read from URLs and files can read from data uris.

Here is a short snippet to illustrate how to do it. (View the file hypixel-favicon.png once you run the snippet.):

<?php
$m = new MinecraftStatus('mc.hypixel.net');
$reply = $m->ping(false);
$img = file_get_contents($reply['json']['favicon']);
file_put_contents('hypixel-favicon.png', $img);

I usually try to update mcstat when significant changes are made to the protocol, but Mojang has been good about this, with only one protocol breaking change.

More info:

winny- avatar Aug 06 '16 18:08 winny-