Player Images
Player photos and club logos are public files on the MFL CDN, https://d13e14gtps4iwl.cloudfront.net.
Player photos
https://d13e14gtps4iwl.cloudfront.net/players/v2/{playerId}/photo.webp
A 960×960 WebP with a transparent background, head and torso. Some players, such as Arena-generated ones, have an imagePath in their API object: their photo is at https://d13e14gtps4iwl.cloudfront.net/{imagePath} instead. A few players have no photo (the URL answers 403 or 404): show a placeholder.
Club logos
https://d13e14gtps4iwl.cloudfront.net/u/clubs/{clubId}/logo.webp?v={logoVersion}
logoVersion comes with the club in API responses; it changes when the owner uploads a new logo, so it busts caches. A club that isn't founded yet (status other than FOUNDED or PENDING_VALIDATION) shows its license instead: https://d13e14gtps4iwl.cloudfront.net/clubs/{clubId}/licenses/foundation_512.png. Arena clubs without a logo have no file: show the club's initials.
User avatars come as a full URL in avatar on user objects: use it as is.
React components
Two standalone components, with React as their only dependency: copy the file into your project and pass it a player from the API (GET /players/{playerId} → player, or any player object from a list). Each file is self-contained, so you can take one without the other.
PlayerCard.tsx draws the player card as in the MFL app, in SVG: rarity frame, overall, primary position, age, photo, name and the six stats (PAC, SHO, PAS, DRI, DEF, PHY), or the goalkeeping rating for a goalkeeper. The rarity comes from the overall: common up to 54, limited 55–64, uncommon 65–74, rare 75–84, legendary 85–94, ultimate 95 and up. Long names shrink, then end with "…"; a player without a photo shows his initials.
| Prop | Default | |
|---|---|---|
player | id, imagePath and metadata (firstName, lastName, overall, positions, age, the six stats, goalkeeping). Every metadata field is optional. | |
width | 200 | Width in pixels; the height follows (about 1.67 × the width). |
frame | true | Draw the MFL card frame, an image on the CDN. false draws a plain shape in the rarity colours. |
fontFamily | Oxanium, system-ui, sans-serif | The app uses Oxanium; load it yourself to match. |
import { PlayerCard } from './PlayerCard'
<PlayerCard player={player} width={180} />
PlayerImage.tsx shows the photo. It builds the URL, falls back to the player's initials when there is no photo, and can tint the background with the player's rarity colour.
import { PlayerImage } from './PlayerImage'
<PlayerImage player={player} size={96} variant="avatar" />
// MFL player card: a standalone React component (no dependency besides React 18+).
// Copy it into your project and pass the player object you got from the MFL API
// (GET /players/{playerId} → player). It draws an SVG card that scales to `width`.
import { useId, useState, type CSSProperties } from 'react'
export const MFL_CDN_URL = 'https://d13e14gtps4iwl.cloudfront.net'
export interface PlayerCardSource {
id: number
// Set on some players (e.g. Arena-generated ones): their photo lives at this path instead.
imagePath?: string | null
metadata: {
firstName?: string
lastName?: string
overall?: number
positions?: string[]
age?: number
pace?: number
shooting?: number
passing?: number
dribbling?: number
defense?: number
physical?: number
goalkeeping?: number
}
}
// Same rule as PlayerImage.tsx: 960x960 transparent WebP, head and torso.
export function playerImageUrl(player: Pick<PlayerCardSource, 'id' | 'imagePath'>): string {
return player.imagePath
? `${MFL_CDN_URL}/${player.imagePath}`
: `${MFL_CDN_URL}/players/v2/${player.id}/photo.webp`
}
export type Rarity = 'common' | 'limited' | 'uncommon' | 'rare' | 'legendary' | 'ultimate'
interface RarityStyle {
minOverall: number
color: string
background: string
text: [color: string, offset: number][]
separator: string
}
// Colours from the MFL app.
const RARITIES: Record<Rarity, RarityStyle> = {
ultimate: { minOverall: 95, color: '#00ffe9', background: '#063330', text: [['#d9ece7', 0], ['#83ebe2', 0.51], ['#7dd1ca', 1]], separator: '#f8ed90' },
legendary: { minOverall: 85, color: '#fa53ff', background: '#2c0d2d', text: [['#d6d6d6', 0], ['#b137f1', 0.51], ['#e63df8', 1]], separator: '#bf36f1' },
rare: { minOverall: 75, color: '#0077ff', background: '#09152f', text: [['#97e5ff', 0], ['#1f8eff', 0.51], ['#3992ff', 1]], separator: '#175bd6' },
uncommon: { minOverall: 65, color: '#71ff30', background: '#243b1e', text: [['#bfffd9', 0], ['#38ff7a', 0.51], ['#37cb6f', 1]], separator: '#2eea81' },
limited: { minOverall: 55, color: '#ecd17f', background: '#3a3526', text: [['#d6d6d6', 0], ['#ecd27e', 0.51], ['#cdb66b', 1]], separator: '#fdefa2' },
common: { minOverall: 0, color: '#bebebe', background: '#363636', text: [['#ffffff', 0], ['#cecece', 1]], separator: '#ffffff' },
}
// common 0–54, limited 55–64, uncommon 65–74, rare 75–84, legendary 85–94, ultimate 95–100.
export function playerRarity(overall: number): Rarity {
return (Object.keys(RARITIES) as Rarity[]).find((r) => overall >= RARITIES[r].minOverall) ?? 'common'
}
const STATS = [
['pace', 'PAC'],
['shooting', 'SHO'],
['passing', 'PAS'],
['dribbling', 'DRI'],
['defense', 'DEF'],
['physical', 'PHY'],
] as const
const VIEW_W = 128.27
const VIEW_H = 214.118
const NAME_MAX_WIDTH = 112
// Average width of an uppercase glyph, in em: names are shrunk, then cut with "…", to fit the card.
const GLYPH_EM = 0.66
function fitName(text: string, size: number): { text: string; size: number } {
const fits = (s: number) => text.length * GLYPH_EM * s <= NAME_MAX_WIDTH
if (fits(size)) return { text, size }
const min = size * 0.72
if (fits(min)) return { text, size: NAME_MAX_WIDTH / (text.length * GLYPH_EM) }
const max = Math.floor(NAME_MAX_WIDTH / (GLYPH_EM * min)) - 1
return { text: `${text.slice(0, max).trimEnd()}…`, size: min }
}
export interface PlayerCardProps {
player: PlayerCardSource
// Width in px; the height follows (ratio ≈ 0.6).
width?: number
// Draw the official MFL card frame from the CDN. false: a plain shape in the rarity colours.
frame?: boolean
fontFamily?: string
className?: string
style?: CSSProperties
}
export function PlayerCard({ player, width = 200, frame = true, fontFamily = 'Oxanium, system-ui, sans-serif', className, style }: PlayerCardProps) {
const uid = useId().replace(/[^a-zA-Z0-9_-]/g, '')
const ref = (name: string) => `mfl-card-${uid}-${name}`
const [photoFailed, setPhotoFailed] = useState(false)
const [frameFailed, setFrameFailed] = useState(false)
const m = player.metadata
const overall = m.overall ?? 0
const rarity = playerRarity(overall)
const rs = RARITIES[rarity]
const position = m.positions?.[0] ?? ''
const isGk = position === 'GK'
const fullName = [m.firstName, m.lastName].filter(Boolean).join(' ') || `Player ${player.id}`
const first = fitName((m.firstName ?? '').toUpperCase(), 12.3)
const last = fitName((m.lastName ?? '').toUpperCase(), 14.2)
const initials = ((m.firstName?.[0] ?? '') + (m.lastName?.[0] ?? '')).toUpperCase() || '?'
const stat = (v?: number) => (v === undefined ? '–' : String(v))
const label = `${fullName}, ${m.overall ?? 'unknown'} overall${position ? `, ${position}` : ''}`
return (
<svg
viewBox={`0 -14 ${VIEW_W} ${VIEW_H}`}
width={width}
height={(width * VIEW_H) / VIEW_W}
role="img"
aria-label={label}
className={className}
style={{ display: 'block', overflow: 'visible', ...style }}
fontFamily={fontFamily}
>
<title>{label}</title>
<defs>
<linearGradient id={ref('text')} x1="100%" y1="34%" x2="0%" y2="66%">
{rs.text.map(([c, o]) => <stop key={o} offset={o} stopColor={c} />)}
</linearGradient>
<linearGradient id={ref('shape')} x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stopColor="#111113" />
<stop offset="1" stopColor={rs.background} />
</linearGradient>
<linearGradient id={ref('fade')} x1="0" y1="100.7" x2="0" y2="135.7" gradientUnits="userSpaceOnUse">
<stop offset="0" stopColor="#fff" />
<stop offset="0.78" stopColor="#000" />
</linearGradient>
<mask id={ref('photo-mask')} maskUnits="userSpaceOnUse">
<rect x="3.46" y="-29.3" width="121.4" height="169" fill={`url(#${ref('fade')})`} />
</mask>
<linearGradient id={ref('glass')} x1="0" y1="84" x2="0" y2="24.6" gradientUnits="userSpaceOnUse">
<stop offset="0" stopColor="#8f8f8f" stopOpacity=".65" />
<stop offset=".6" stopColor="#555" stopOpacity=".5" />
<stop offset="1" stopColor="#222" stopOpacity=".6" />
</linearGradient>
<linearGradient id={ref('glass-line')} x1="3.3" x2="28.8" y1="0" y2="0" gradientUnits="userSpaceOnUse">
<stop offset=".08" stopColor="#fff" stopOpacity="0" />
<stop offset=".5" stopColor="#fff" />
<stop offset=".92" stopColor="#fff" stopOpacity="0" />
</linearGradient>
</defs>
<g aria-hidden="true">
<path
d="M34 5.6h60.3l5.6 15.3h27.6v156.6L64.1 199.6.8 177.5V20.9h27.6z"
fill={`url(#${ref('shape')})`}
stroke={rs.color}
strokeWidth="1.4"
strokeLinejoin="round"
/>
{frame && !frameFailed && (
<image
href={`${MFL_CDN_URL}/players/v2/_elements/${rarity}-bg.webp`}
x="0"
y="5.3"
width={VIEW_W}
height="194.82"
preserveAspectRatio="none"
onError={() => setFrameFailed(true)}
/>
)}
{photoFailed ? (
<text x="64.1" y="72" textAnchor="middle" dominantBaseline="middle" fontSize="40" fontWeight="600" fill="#fff" fillOpacity=".55">
{initials}
</text>
) : (
<image
href={playerImageUrl(player)}
x="-15.85"
y="-12.66"
width="160"
height="160"
mask={`url(#${ref('photo-mask')})`}
onError={() => setPhotoFailed(true)}
/>
)}
<path
d="M3.33 24.62h25.48v49.5c0 5.36-4.45 9.9-9.61 9.87H3.33z"
fill={`url(#${ref('glass')})`}
stroke="#fff"
strokeOpacity=".35"
strokeWidth=".26"
/>
<path d="M3.35 58.74h25.3" stroke={`url(#${ref('glass-line')})`} strokeOpacity=".5" strokeWidth=".26" />
<text x="16.02" y="38.7" textAnchor="middle" dominantBaseline="middle" fontSize="17.1" fontWeight="600" fill={`url(#${ref('text')})`}>
{m.overall ?? '–'}
</text>
<text x="16.02" y="51.7" textAnchor="middle" dominantBaseline="middle" fontSize="8.3" fontWeight="600" fill="#fff">
{position}
</text>
{m.age !== undefined && (
<>
<text x="16.02" y="66.7" textAnchor="middle" dominantBaseline="middle" fontSize="4.4" fontWeight="500" fill="#fff">
AGE
</text>
<text x="16.02" y="74.2" textAnchor="middle" dominantBaseline="middle" fontSize="9" fontWeight="500" fill="#fff">
{m.age}
</text>
</>
)}
<text x="64.2" y="122" textAnchor="middle" dominantBaseline="middle" fontSize={first.size} fill="#fff">
{first.text}
</text>
<text x="64.2" y="134.5" textAnchor="middle" dominantBaseline="middle" fontSize={last.size} fontWeight="600" fill={`url(#${ref('text')})`}>
{last.text}
</text>
{isGk ? (
<text x="64.2" y="162" textAnchor="middle" dominantBaseline="middle" fontSize="15" fill="#fff">
<tspan fontWeight="600">{stat(m.goalkeeping)} </tspan>
<tspan fontWeight="400">GK</tspan>
</text>
) : (
<g fill="#fff" fontSize="8.7">
<path d="M64.2 146.8v28.5" stroke={rs.separator} strokeWidth=".35" />
{STATS.map(([key, abbr], i) => {
const x = 34.8 + 54.5 * Math.floor(i / 3)
const y = 150.2 + 11.3 * (i % 3)
return (
<text key={key} y={y} dominantBaseline="middle">
<tspan x={x - 2.8} textAnchor="end" fontWeight="600">
{stat(m[key])}
</tspan>
<tspan x={x} fontWeight="300">
{abbr}
</tspan>
</text>
)
})}
</g>
)}
</g>
</svg>
)
}
export default PlayerCard
// MFL player image: a standalone React component (no dependency besides React).
// Copy it into your project and pass the player object you got from the MFL API.
import { useState, type CSSProperties } from 'react'
export const MFL_CDN_URL = 'https://d13e14gtps4iwl.cloudfront.net'
export interface PlayerImageSource {
id: number
// Set on some players (e.g. Arena-generated ones): their photo lives at this path instead.
imagePath?: string | null
metadata?: { firstName?: string; lastName?: string; overall?: number }
}
// 960x960 transparent WebP, head and torso.
export function playerImageUrl(player: Pick<PlayerImageSource, 'id' | 'imagePath'>): string {
return player.imagePath
? `${MFL_CDN_URL}/${player.imagePath}`
: `${MFL_CDN_URL}/players/v2/${player.id}/photo.webp`
}
const RARITY_COLORS: [minOverall: number, color: string][] = [
[95, '#00ffe9'], // ultimate
[85, '#fa53ff'], // legendary
[75, '#0077ff'], // rare
[65, '#71ff30'], // uncommon
[55, '#ecd17f'], // limited
[0, '#bebebe'], // common
]
export function rarityColor(overall: number): string {
return RARITY_COLORS.find(([min]) => overall >= min)?.[1] ?? '#bebebe'
}
export interface PlayerImageProps {
player: PlayerImageSource
size?: number
// 'portrait': the whole photo. 'avatar': zoomed on the face, in a circle.
variant?: 'portrait' | 'avatar'
// Background gradient in the player's rarity colour (needs metadata.overall).
withRarity?: boolean
className?: string
style?: CSSProperties
}
export function PlayerImage({ player, size = 96, variant = 'portrait', withRarity = true, className, style }: PlayerImageProps) {
const [failed, setFailed] = useState(false)
const name = [player.metadata?.firstName, player.metadata?.lastName].filter(Boolean).join(' ')
const overall = player.metadata?.overall
const isAvatar = variant === 'avatar'
const box: CSSProperties = {
position: 'relative',
width: size,
height: size,
overflow: 'hidden',
borderRadius: isAvatar ? '50%' : 8,
background:
withRarity && overall !== undefined
? `linear-gradient(to bottom, #1e1e21, ${rarityColor(overall)})`
: '#1e1e21',
flexShrink: 0,
...style,
}
if (failed) {
const initials = (player.metadata?.firstName?.[0] ?? '') + (player.metadata?.lastName?.[0] ?? '')
return (
<div className={className} style={{ ...box, display: 'grid', placeItems: 'center', color: '#ededee', fontSize: size * 0.32, fontWeight: 600 }} aria-label={name || `Player ${player.id}`}>
{initials || '?'}
</div>
)
}
return (
<div className={className} style={box}>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={playerImageUrl(player)}
alt={name || `Player ${player.id}`}
loading="lazy"
onError={() => setFailed(true)}
style={{
position: 'absolute',
inset: 0,
width: '100%',
height: '100%',
objectFit: 'contain',
transformOrigin: 'top',
transform: isAvatar ? 'scale(2.2) translateY(2%)' : undefined,
}}
/>
</div>
)
}
export default PlayerImage
Building with an AI assistant? Point it to guide.playmfl.com/llms.txt.

