Check out this post. I should address your issue. https://markjames.dev/blog/dynamically-importing-images-astro