minotar / imgd

Minotar is a global avatar service that pulls your head off of your Minecraft.net skin, and allows it for use on several thousand sites.
https://minotar.net/
The Unlicense
201 stars 61 forks source link

File ends mess up skin fetch #63

Closed ToniTang closed 10 years ago

ToniTang commented 10 years ago

When you do not include the file type extension to a size change at the end of a URL to minotar, it reverts back to the default Steve skin.

An example would be this: http://minotar.net/helm/ToniTang/300 would be a Steve skin

However when you add a file type extension it seems to work http://minotar.net/helm/ToniTang/300.png

clone1018 commented 10 years ago

This is what I'm seeing:

2014-01-29_10-32-15

ToniTang commented 10 years ago

olokuie

This is what I am now seeing. Is this an issue with Minecraft's skin servers? The issue is now reversed between the URLs

(The first image with the actual head showing is without a file extension type defined).

clone1018 commented 10 years ago

Your browser has the second image cached it seems, I get your avatar properly when I do https://minotar.net/helm/ToniTang/300.png

ToniTang commented 10 years ago

Ah I see, it was a cache issue. However these issues I'm trying to show here happen on my staff list:

http://realmsofpvp.net/staff

As you may see, a lot of them have Steve heads because of their case-sensitive names. Under the other owner's name: "chayne_" it displays a default Steve skin head:

https://minotar.net/helm/chayne_/105.png

However when it's changed to a capital C as so:

https://minotar.net/helm/Chayne_/105.png

It shows just fine. I cannot (even though I wish) change the case sensitivity of the usernames on my site as it retrieves it from zPermission's database which does not add case sensitive names into the database for various reasons. I was informed, and I also believe that with the case-insensitivity fetching was a much better option then modifying an entire structure to a database to a plugin that is used by many servers.

clone1018 commented 10 years ago

zPermission should be storing them case sensitive :)

We had a feature that resolved the users skin regardless, based on Mojang's API but that functionality is temporarily disabled due to performance issues. It should be back soon.

ToniTang commented 10 years ago

I wish they were to be honest. I asked and they said it would be too much work to make it so.

And yes, I remember that, it actually was in service just a few weeks ago if I'm not mistaken. Can't wait for it to be fixed.

clone1018 commented 10 years ago

Literally two days ago :)

MisterFixx commented 10 years ago

I don't like to be a joiner but i made a PHP script that gets the UUID and the real full cased username of a player, making stuff not case sensitive if you want it i can post it.

ToniTang commented 10 years ago

I'd like to try it for the time being please, are you on Spigot forums?

MisterFixx commented 10 years ago

Nope, i can just post it here. it's not too long, just 30 lines.

ToniTang commented 10 years ago

Alrighty. I just didn't want to interfere with Minotar's issue tracking.

MisterFixx commented 10 years ago
<?php
ini_set("display_errors", false);

$user = $_GET['user'];
if(!isset($_GET['user'])){
$user = "char";
}
if(empty($_GET['user'])){
$user = "char";
}
$arr = array("name"=>$user, "agent"=>"minecraft");
$data = json_encode($arr);

$ch = curl_init('https://api.mojang.com/profiles/page/1');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data))
    );
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

if(!($res = curl_exec($ch))) {
    echo('[cURL Failure] ' . curl_error($ch));
}

curl_close($ch);
echo $res;
?>
ToniTang commented 10 years ago

Thank you, I appreciate it.

MisterFixx commented 10 years ago

No problem.

MisterFixx commented 10 years ago

I see that you still haven't managed to fix the issue you had with your website, you can try using http://www.mc-heads.net, it's not case sensitive...

ToniTang commented 10 years ago

Ah yes, I tried using the script however I think I may be using it improperly. I tried using it via filename.php?user=name however I didn't exactly return anything else besides a blank screen. Maybe I'm missing some extensions?

MisterFixx commented 10 years ago

here's the same script after some work. the only thing it should return is the correctly cased username; <?php ini_set("display_errors", false); $user = $_GET['user']; $arr = array("name"=>$user, "agent"=>"minecraft"); $data = json_encode($arr);

$ch = curl_init('https://api.mojang.com/profiles/page/1'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data)) ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

if(!($res = curl_exec($ch))) { echo('[cURL Failure] ' . curl_error($ch)); }

curl_close($ch); echo $res; $username = json_decode($res, true); echo $username['profiles']['0']['name']; ?>

clone1018 commented 10 years ago

Just wanted to let everyone know, I just pushed out all of the fixes required to get Minotar on track with the new skin system and I've made some big improvements to how images are generated and cached. If anyone is still having issues please make a new GitHub issue and I'll gladly help you out.

Thanks!