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, and on pop-up you should get an unoptimized (the original) version.
The problem?
They don't show up.
This is how I call it:
<Image src={`${src}`} width={200} height={300} alt={`${alt}`} position="top" class="img-about" format="webp" quality={100}/>
In local host, I'm able to see the image using this JS function:
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();
});
});
I store them dynamically in a dialog box to have some sort of preview.
What is the issue?
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.