I have the following issue.
In my website, I have these images: https://myndi.dev/about/#My-projects
They're optimized with Astro Image on build using:
<Image src={`${src}`} width={200} height={300} alt={`${alt}`} position="top" class="img-about" format="webp" quality={100}/>
And when clicking on them, they pop-up and you get an unoptimized (the original) version, through:
imgWrappers.forEach(wrapper => {
wrapper.addEventListener('click', () => {
const img = wrapper.querySelector('img');
const src = img.getAttribute('src').split('&href=')[1];
const decodedSrc = decodeURIComponent(src);
console.log(decodedSrc);
expandedImg.setAttribute('src', decodedSrc);
dialog.showModal();
});
});
The problem?
They don't show up in production.
In local host, I'm able to see the image thanks to the JS function, because it refers to the /public folder.
I store them dynamically in a dialog box to have some sort of preview.
What is happening?
The decoded version gives me the following path for the image /images/image.png, but on built time this paths gets changed. So in production the src path is undefined.
Does anyone have a suggestion or a better way to achieve this?
Or perhaps, how could I reference the path after it has been built?
Reasoning
The only reason I'm doing this, is because I want to access the full length of the image when showing the preview, since the Image component cuts it.
