Skip to content

Help with large image streaming #8689

Discussion options

You must be logged in to vote

Turns out you can just use the stream url directly in the src of the img tag, Im so fucking dumb. All i had to do was modify my backend so i also checked for a query token in order to authorize the request and bam, everything loads fast, the browser handles it and all is good!

Modifications:

function RenderThumb({ id }: { id: string }) {
  const downloadUrl = getContentUrl(id)

  return (
    <img
      loading="lazy"
      src={downloadUrl}
      alt="Happy New Year with eucalyptus leaves"
      className="h-44 w-full object-cover transition-transform duration-300 group-hover:scale-105"
    />
  )
}


export function getContentUrl(id: ContentModel["id"]) {
  const url = `/api/v1/content/…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ludersGabriel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant