Help with Image Addresses in the API

Avatar image for rangersedge
rangersedge

8

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Could someone either help me or point me in the direction of using the images portion of the API? I am using MS Access to retrieve the information. I have it download and XML of the game and import the information I need. I just need to figure out how the Image addresses work. I have this working on a different site but they use the games ID in the image address where Giant Bomb doesn't seem to. Giant Bomb also seems to download some image addresses automatically and then just display others. Any help?

Avatar image for lordandrew
LordAndrew

14609

Forum Posts

98305

Wiki Points

0

Followers

Reviews: 0

User Lists: 36

The image field for each game result contains multiple fields representing different sizes of the same image. Experiment with the provided URLs below to see which size best fits your use case. super_url is the largest available size, but you can also retrieve the original unscaled image by replacing "scale_large" in the URL with "original".

For /games/, a simplified API response will look like this:

<response>
<results>
<game>
<id>1</id>
<image>
<icon_url>http://static.giantbomb.com/uploads/square_avatar/9/93770/2370498-genesis_desertstrike_2__1_.jpg</icon_url>
<medium_url>http://static.giantbomb.com/uploads/scale_medium/9/93770/2370498-genesis_desertstrike_2__1_.jpg</medium_url>
<screen_url>http://static.giantbomb.com/uploads/screen_medium/9/93770/2370498-genesis_desertstrike_2__1_.jpg</screen_url>
<small_url>http://static.giantbomb.com/uploads/scale_small/9/93770/2370498-genesis_desertstrike_2__1_.jpg</small_url>
<super_url>http://static.giantbomb.com/uploads/scale_large/9/93770/2370498-genesis_desertstrike_2__1_.jpg</super_url>
<thumb_url>http://static.giantbomb.com/uploads/scale_avatar/9/93770/2370498-genesis_desertstrike_2__1_.jpg</thumb_url>
<tiny_url>http://static.giantbomb.com/uploads/square_mini/9/93770/2370498-genesis_desertstrike_2__1_.jpg</tiny_url>
</image>
<name>Desert Strike: Return to the Gulf</name>
</game>
</results>
</response>

For /game/1/, a simplified API response will look like this:

<response>
<results>
<id>1</id>
<image>
<icon_url>http://static.giantbomb.com/uploads/square_avatar/9/93770/2370498-genesis_desertstrike_2__1_.jpg</icon_url>
<medium_url>http://static.giantbomb.com/uploads/scale_medium/9/93770/2370498-genesis_desertstrike_2__1_.jpg</medium_url>
<screen_url>http://static.giantbomb.com/uploads/screen_medium/9/93770/2370498-genesis_desertstrike_2__1_.jpg</screen_url>
<small_url>http://static.giantbomb.com/uploads/scale_small/9/93770/2370498-genesis_desertstrike_2__1_.jpg</small_url>
<super_url>http://static.giantbomb.com/uploads/scale_large/9/93770/2370498-genesis_desertstrike_2__1_.jpg</super_url>
<thumb_url>http://static.giantbomb.com/uploads/scale_avatar/9/93770/2370498-genesis_desertstrike_2__1_.jpg</thumb_url>
<tiny_url>http://static.giantbomb.com/uploads/square_mini/9/93770/2370498-genesis_desertstrike_2__1_.jpg</tiny_url>
</image>
<name>Desert Strike: Return to the Gulf</name>
</results>
</response>

The download vs. display issue seems like it should only affect browsers. Is this incorrect? What method are you using to download the images?

When you download the images, there is nothing in the URL that indicates which game they are associated with. In fact, an image can be associated with any number of games. If you are downloading them all first (as opposed to associating the image URL with your data and downloading it only when it is to be shown), you should include the ID in the download URL. So instead of downloading an image to say, C:\path\to\file\<icon_url>, download it to C:\path\to\file\<id>.jpg. Then later you can ask it to display C:\path\to\file\<id>.jpg and it will display the image you want.