Headshot URLs
{
"espn": {
"Patrick Mahomes": "https://a.espncdn.com/combiner/i?img=/i/headshots/nfl/players/full/3139477.png",
"Justin Herbert": "https://a.espncdn.com/combiner/i?img=/i/headshots/nfl/players/full/4038941.png",
"Bo Nix": "https://a.espncdn.com/combiner/i?img=/i/headshots/nfl/players/full/4426338.png"
},
"LeBron James (nba 2544)": "https://cdn.nba.com/headshots/nba/latest/260x190/2544.png",
"A'ja Wilson (wnba 1628932)": "https://cdn.wnba.com/headshots/wnba/latest/260x190/1628932.png",
"Shohei Ohtani (mlb 660271)": "https://img.mlbstatic.com/mlb-photos/image/upload/d_people:generic:headshot:67:current.png/w_213,q_auto:best/v1/people/660271/headshot/67/current.png",
"Connor McDavid (nhl 8478402)": "https://assets.nhle.com/mugs/nhl/latest/8478402.png",
"HEADSHOT_ASPECT": "1.376",
"ESPN_HEADSHOT_LEAGUES": {
"nfl": "nfl",
"nba": "nba",
"wnba": "wnba",
"mlb": "mlb",
"nhl": "nhl",
"cfb": "college-football",
"mbb": "mens-college-basketball",
"wbb": "womens-college-basketball"
}
}import { STANDINGS } from "@sportsdataverse/examples/data";
import {
ESPN_HEADSHOT_LEAGUES,
HEADSHOT_ASPECT,
headshotUrl,
mlbHeadshotUrl,
nbaHeadshotUrl,
nhlHeadshotUrl,
wnbaHeadshotUrl,
} from "@sportsdataverse/sdvplot";
// ESPN player ids work in every league ESPN_HEADSHOT_LEAGUES lists; nothing is loaded or fetched.
const espn = Object.fromEntries(STANDINGS.slice(0, 3).map((s) => [s.qb, headshotUrl(s.qb_espn_id, "nfl")]));
{
espn,
// Each league's own CDN, by that league's player id.
"LeBron James (nba 2544)": nbaHeadshotUrl(2544),
"A'ja Wilson (wnba 1628932)": wnbaHeadshotUrl(1628932),
"Shohei Ohtani (mlb 660271)": mlbHeadshotUrl(660271),
"Connor McDavid (nhl 8478402)": nhlHeadshotUrl(8478402),
HEADSHOT_ASPECT: HEADSHOT_ASPECT.toFixed(3), // width / height of an ESPN headshot box
ESPN_HEADSHOT_LEAGUES,
};
Tags: headshots · urls. All sdvplot examples.