swagger ui
I’m working on getting player thumbnails but I don’t know how to retrieve a game icon.
I tried using MarketplaceService:GetProductInfo(gameId) and it worked only for games that had legit game icons.
If they were just default, it never showed the game icon(which I still want it to show something).
Any ideas? Is there another way I should be doing this?
1 Like
frost2yy
(frost2yy)
July 17, 2024, 12:29am
#2
I mean you could always use an if statement to detect if it found a game Icon and if didn’t just set the Decal, ImageLabel, or whatever you’re using to one of the default logo’s Roblox provides.
I tried that using 7229442422 and got some random image. I’m gonna see if some external api accounts for default icons.
frost2yy
(frost2yy)
July 17, 2024, 12:32am
#4
Did you try downloading the default logo first and uploading it to Roblox yourself?
EDIT: Changed Game icons to player icons, Misread orignal post. Still stands tho
Roblox has a post about this actually!
Hello Developers,
RbxThumb is a new ContentId format that allows easy loading of thumbnails. It works everywhere you would expect image ContentIds to work including in ImageLabel.Image and ContentProvider:PreloadAsync.
The format for an RbxThumb contentId is “rbxthumb://type=[ThumbnailType]&id=[TargetId]&w=[Width]&h=[Height]”. The order of parameters is enforced.
For example, if you wanted an ImageLabel with a thumbnail of my lovely avatar on it you would set the Image property to:
rbxthumb:…
You can use it to get game icons in 48x48
, 60x60
and 150x150
resolution. A example URL is this:
rbxthumb://type=AvatarHeadShot&id=7229442422&w=150&h=150
^ The ID you gave icon at 150x150
resolution, Now you can use it as a normal image url.
Well I tried this line of code but nothing happened:
newGameFrame.GameIcon.Image = "rbxthumb://type=GameIcon&id=".. marketInfo.IconImageAssetId ~= 0 and marketInfo.IconImageAssetId or 7229442422 .."&w=150&h=150"
I think it would be better to see if I could use a link or url rather than re downloading it.
Change GameIcon
to AvatarHeadShot
I misread the orignal post and wrote abt the wrong type
Wait im confused now do you want player icons or game icons? Cause your mentioning both in your post.
Didn’t seem to work either, are you sure it is AvatarHeadShot? Wouldn’t GameIcons be for game icons only and avatars be seperate?
Yeah, If you want player icons use AvatarHeadShot
if you want game icons use GameIcon
, I got confused while reading your post.
Here is a example of a working GameIcon
:
rbxthumb://type=GameIcon&id=3351674303&w=150&h=150
This is a example of a working AvatarHeadShot
:
rbxthumb://type=AvatarHeadShot&id=140975395&w=150&h=150
Sadly didn’t work, I’ll try other Content but I don’t really know how to use Games > Icons because it doesn’t include any params in the url.
I think it would work though because it provides an entire image Url and not a assetId or a number.