Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render guild emblems #4

Open
darthmaim opened this issue Apr 8, 2016 · 4 comments
Open

Render guild emblems #4

darthmaim opened this issue Apr 8, 2016 · 4 comments

Comments

@darthmaim
Copy link
Member

Add a helper to render guild emblems from the emblem data returned from the API.

@FreezyExp
Copy link

FreezyExp commented Oct 20, 2016

this works:
https://github.com/mtodor/gw2emblem

with some minor adjustments to get the new data

You will also need to add a get($GuildID) to the guild endpoint, in order to get the emblem data
` $guildData = $api->guild()->get($session->guildID);
echo '

Guild: ['. $guildData->tag .'] '.$guildData->name.'

';

        ?>
        <script type="text/javascript">
            $(document).ready(function() {      
                gw2emblem.init('gw2emblem-div', 128);
                gw2emblem.drawEmblemGw2(
                <?php 
                    //{"background":{"id":23,"colors":[473]},"foreground":{"id":118,"colors":[584,473]},"flags":[]}
                    echo '{';
                    echo '"background_id":'.$guildData->emblem->background->id.',';
                    echo '"foreground_id":'.$guildData->emblem->foreground->id.',';
                    echo '"flags":['.implode(",",$guildData->emblem->flags).'],';
                    echo '"background_color_id":'.$guildData->emblem->background->colors[0].',';
                    echo '"foreground_primary_color_id":'.$guildData->emblem->foreground->colors[1].',';
                    echo '"foreground_secondary_color_id":'.$guildData->emblem->foreground->colors[0].'';           
                    echo '}';
                ?> );
            });
        </script>`

@darthmaim
Copy link
Member Author

The issue for adding /v2/guild/:id is here: GW2Treasures/gw2api#95. I just didn't have time lately to do this.

I want to render the emblems in php with this library and not with javascript, so it can be used to render them server side (for example for clients without javascript, or social network images, ...). There are a few php implementations floating around, and I even started writing my own when I made this issue half a year ago, but again, I didn't have time to finish my own or to look at the existing solutions and clean them up.

I'm currently working on rendering static maps with this library (#7), I try to look into this again when I'm done with the maps, because rendering guild emblems is something really useful.

@FreezyExp
Copy link

how about this as an alternative:
https://guilds.gw2w2w.com/guilds/

@darthmaim
Copy link
Member Author

Thats fine when you want to use a 3rd party service, but sometimes you want to generate them on your server and not rely on the availability of a 3rd party.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants