Skip to content

Store only the relative path in CardPrinting.imageUrl #315

@jbourdin

Description

@jbourdin

Context

Currently `CardPrinting.imageUrl` stores the full CDN URL:
```
https://assets.tcgdex.net/en/sv/sv02/001/high.webp
```

With the local TCGdex model (#314), `TcgdexCard::getImageUrl()` already computes this from the entity hierarchy with configurable resolution and format. For cards sourced from the local DB, the URL is fully derivable.

Current Decision

Deferred. `CardPrinting.imageUrl` stays as a full URL for now because:

  1. Multiple sources — the URL may come from TCGdex CDN, pokemontcg.io fallback, or static overrides. These have different base URLs and path conventions, so a single relative path format doesn't cover all cases.
  2. Fallback chain (Image download fallback chain with URL update on success #316) — when a CDN URL returns 404, the resolved working URL is written back to `CardPrinting.imageUrl`. This URL may be from a different CDN entirely.
  3. Existing CardPrinting rows — already store full URLs from the API. Migration would need to detect the source and strip accordingly.

Future Approach

Once #316 (fallback chain) is implemented and stabilized, we could:

  1. Normalize all URLs to a `{source}:{path}` format (e.g. `tcgdex:sv/sv02/001`, `pokemontcgio:sv01/1`)
  2. A URL builder resolves the full URL at render time with resolution/format params
  3. This would save ~100 bytes per row across 23k+ cards

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions