Next.js Discord

Discord Forum

Where to store images | Nextjs + react-email

Unanswered
Naeemgg posted this in #help-forum
Open in Discord
In order to use images in react-email where do we need to store them?? I have already tried storing it in public folder as well as many other places in the project still the Img component's src isn't showing its a valid URL and falling to alt text. I'm not getting any errors as well so that I can understand what is wrong.

23 Replies

Chilean jack mackerel
Hello
I can help you.
Please DM.
@Naeemgg In order to use images in react-email where do we need to store them?? I have already tried storing it in `public` folder as well as many other places in the project still the `Img` component's `src` isn't showing its a valid URL and falling to `alt` text. I'm not getting any errors as well so that I can understand what is wrong.
first you want to use either the img or the Image component. Then you want to make sure, that the url, that you enter is reachable. So try console.log your image src and visit this image by yourself. Then it should be reachable.

If you want to store it inside your public folder, that's fine. Others ways would be, that you store it in a s3 bucket or r2. Then only make sure, that you using a cdn as well, to serve your data efficent
@Chilean jack mackerel I can help you.
others may also want to know the solution, so please stay in thread.
I'm using Img from react-email
https://react.email/docs/components/image
checked the URL its valid
@Naeemgg Yes its reachable
can you open the devtools for your email? Does a webversion or something like that exists, so you can go into the devtools?
if you look at these examples
all of them are using src as src={${baseUrl}/static/vercel-logo.png}`
where baseUrl is process.env.VERCEL_URL
I tried this way also but isnt working, I know there's a small thing what I'm missing but donno what
@Naeemgg checked?
And for the images issue I have contaced react-email support and acc to them its better to put images somewhere onln and use a cdn to reach it
not locally, so I'm using images by cdn now
btw thanks man for your attention @B33fb0n3 !!! :sunglasses_1:
👍
yes, the message links to a specific message in this thread, to highlight it, because it haven't answered at this time