Next.js Discord

Discord Forum

Images Caching Nextjs Vercel Help

Unanswered
White-eyed Vireo posted this in #help-forum
Open in Discord
White-eyed VireoOP
Hey, I have ~500 images in my public/images folder and once in a while I might update one, would it be possible to setup a very long cache such as 1 year while being able to update an image at any time with the users receiving the newly updated image?

1 Reply

White-eyed VireoOP
This is my current code:
export function getChampionBgUrl(championName: string): string {
  return `/images/champions/splash/${championName}.jpg`;
}

<Image
  src={getChampionBgUrl(championName)}
  alt={`${championName} Splash Art`}
  className="rounded opacity-30 object-cover"
  fill
  priority
/>