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

How can I call the game icon? #131

Open
mrranger opened this issue Jun 13, 2022 · 1 comment
Open

How can I call the game icon? #131

mrranger opened this issue Jun 13, 2022 · 1 comment
Milestone

Comments

@mrranger
Copy link

mrranger commented Jun 13, 2022

I'm trying to call the game icon, but instead of the picture I always get a link to the steam picture
I want to make sure that each game has its own picture
help me please
Require

Laravel 9 + AdminLTE

https://prnt.sc/N_Kh8b6l9HV6

                   @if(isset($account->OwnedGames) && count($account->OwnedGames) > 0)
                        <div class="row col justify-content-center">
                            <label for="GameList" class="text-center">Game List</label>
                        </div>

                        <div class="row col justify-content-center">
                            <select name="GameList" id="multiSelect" multiple="multiple">

                                @foreach($account->OwnedGames as $game)
                                    <option  value="{{$game->appId}}">{{$game->name}} </option>

                                @endforeach

                             </select>
                         </div>
                     @else
@Teakowa
Copy link
Contributor

Teakowa commented Jan 31, 2023

Let me think about it, You are trying to get the game icon like Dota is right?

If so, game icons are provided by two APIs under IPlayerService:

https://api.steampowered.com/IPlayerService/GetOwnedGames/v1/
https://api.steampowered.com/IPlayerService/GetRecentlyPlayedGames/v1/

The API will return a img_icon_url key, it looks like this: 0bbb630d63262dd66d2fdd0f7d37e8661a410075

Then you can get the icon by url splicing:

https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/apps/{appid}/{img_icon_url}.jpg
https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/apps/570/0bbb630d63262dd66d2fdd0f7d37e8661a410075.jpg

But I remember that this package provides this feature, i see in

$this->icon = $this->checkIssetImage($app, 'img_icon_url');
$this->logo = $this->checkIssetImage($app, 'img_logo_url');

public function GetOwnedGames($includeAppInfo = true, $includePlayedFreeGames = false, $appIdsFilter = [])
{
// Set up the api details
$this->setApiDetails(__FUNCTION__, 'v0001');
// Set up the arguments
$arguments = ['steamId' => $this->steamId];
if ($includeAppInfo) {
$arguments['include_appinfo'] = $includeAppInfo;
}
if ($includePlayedFreeGames) {
$arguments['include_played_free_games'] = $includePlayedFreeGames;
}
$appIdsFilter = (array) $appIdsFilter;
if (count($appIdsFilter) > 0) {
$arguments['appids_filter'] = $appIdsFilter;
}
// Get the client
$client = $this->getServiceResponse($arguments);
// Clean up the games
return $this->convertToObjects(isset($client->games) ? $client->games : []);
}

You can use

Steam::player($steamId)->GetOwnedGames();
Steam::player($steamId)->GetRecentlyPlayedGames()

to get game icon.

For more information you can refer to package documentation or Steam Web API Documentation by xPaw.

@nicekiwi nicekiwi added this to the 3.1.0 milestone Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants