teerullino10 Posted February 26, 2018 Report Posted February 26, 2018 Hi, I'm a newbie coder and am having trouble with fetching csgo item images for an experimental exchange site.All this is what I have so far on deposit matters: This is the deposit section: http://prntscr.com/ik3xnxHere's the price update code: const _ = require('lodash'); const request = require('request'); const Price = require('../models/price'); module.exports = interval => { update(); setInterval(update, interval); }; function update() { request('https://api.csgofast.com/price/all', (err, response, body) => { if (err) { console.log(err); } else { let json = {}; try { json = JSON.parse(body); } catch (e) { console.log(e); } _.forOwn(json, (price, market_hash_name) => { Price.update( { market_hash_name }, { $set: { price } }, { upsert: true }, err => { if (err) { console.log(err); } } ); }); } }); } And here's the HTML: <!-- DEPOSIT MENU --> <div class="deposit"> <h1>Deposit Items</h1> <ul class="deposit"> {{#each items}} <li class="deposit item" data-assetid="{{this.assetid}}">{{market_hash_name}} (${{this.price}}) {{/each}} </ul> </div> How do I get the images to show up, for example over the item name? Quote
McMuffinDK Posted February 27, 2018 Report Posted February 27, 2018 (edited) Use this <img src="https://steamcommunity-a.akamaihd.net/economy/image/{theitem img link}/256fx256f"> Edited February 27, 2018 by McMuffinDK Quote
teerullino10 Posted February 27, 2018 Author Report Posted February 27, 2018 Use this <img src="https://steamcommunity-a.akamaihd.net/economy/image/{theitem img link}/256fx256f">That part I already know but how do I get the item img link in there? Quote
teerullino10 Posted February 27, 2018 Author Report Posted February 27, 2018 Also what is the difference betweenhttps://steamcommunity-a.akamaihd.net/economy/image/class/730/310776773andhttps://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot6-iFBRw7P7NYjV96tOkkZOfqPH9Ib7um25V4dB8xLuVoIqkiVHtrkFoMGjzdoSWdwY6aFvX_Vfow-_mhJS5vs_IwHRhuyk8pSGK2gnD2GcAnd why is the last one used by all the betting sites and not the first one which seems easier to use Quote
McMuffinDK Posted February 27, 2018 Report Posted February 27, 2018 Also what is the difference betweenhttps://steamcommunity-a.akamaihd.net/economy/image/class/730/310776773andhttps://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot6-iFBRw7P7NYjV96tOkkZOfqPH9Ib7um25V4dB8xLuVoIqkiVHtrkFoMGjzdoSWdwY6aFvX_Vfow-_mhJS5vs_IwHRhuyk8pSGK2gnD2GcAnd why is the last one used by all the betting sites and not the first one which seems easier to useThe shorter one is used with the item's market id wich (if i got it right) is hard to get. The long one is in the tradeoffer object that is sent and therefore a lot easier to use Quote
McMuffinDK Posted February 27, 2018 Report Posted February 27, 2018 That part I already know but how do I get the item img link in there? You can get it from the CEconItem object that you can get using node-steam-tradeoffer-manager Quote
teerullino10 Posted February 28, 2018 Author Report Posted February 28, 2018 All I did was change the html deposit section to <!-- DEPOSIT MENU --> <div class="deposit"> <h1>Deposit Items</h1> <ul class="deposit"> {{#each items}} <li class="deposit item" data-assetid="{{this.assetid}}" data-classid="{{this.classid}}">{{market_hash_name}} (${{this.price}}) <img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/{{this.classid}}/150fx125f"> </li> {{/each}} </ul> </div> and it worked like a charm!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.