Skip to content

Integrating dynamic images #1969

Answered by mythmon
spandl asked this question in Q&A
Apr 14, 2025 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

You need to reference the file using FileAttachment.

d3.select(sideBar)
  .append('div')
  .attr('class', 'logo')
  .append('img')
  .attr('src', FileAttachment('../../assets/images/logo.png").href)
```

That will always resolve to the URL of the image when deployed, including when the filename includes a hash for uniqueness. It also tells Framework to include the file in your output bundle.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@spandl
Comment options

@spandl
Comment options

@mythmon
Comment options

mythmon Apr 14, 2025
Collaborator

@spandl
Comment options

@spandl
Comment options

Answer selected by spandl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants