Broken Image on Sending Gmail

Hi, I’m new to make. I’m having an issue with the image I embedded I sent using gmail. I used html code as a content in the email. You can see the link from the screenshot.

But when the recipient received the email, the image is broken.

Upon inspecting it, it shows that the link image is changed to this one:

I would appreciate any help. Thank you!

Hi @Jared_Balajadia,

the link you inserted is a link to the Google drive file, not the image directly.

What you have to do is you have to use this URL:

https://drive.usercontent.google.com/download?id=FILEID

In this URL, you have to replace FILEID with the ID of the file that is between /d/ and /view

You can do that by using regex. Just give ChatGPT the url you get right now and tell it to write regex to get the id from the place I’ve just explained. That should work :smiley:

Let me know if that works, or if you need any more help! :smiley:

Chatgpt gave me this code:

But when I tried it. This is the result:

You don’t need that code, you just need regex to extract the ID from the URL. Tell it that you only want the regex to get the ID from the URL. And then give it the original Google Drive URL as well and tell it which part the ID is (the long random string)

I tried it using the URL you gave me and added the file id from the Google drive file. And still didn’t work.

Ah okay, I had the slight fear it also wouldn’t work in this case. A lot of people have this issue. The reason it doesn’t work is that none of these links are a direct image file link (as you can see as none of them ends with .jpg or .png).

Google doesn’t want users to use Google Drive to host images for these purposes.

I recommend you use AWS S3 in this case, or you search for some other easy hosting tool.

Just did a quick google search and https://postimages.org/ might work. You’ll just have to check if they have a free API.

Otherwise, just google “Simple image hosting” or something like that.

Hope this helps :smiley:

Thank you for the suggestions! Anyway, I’ve found the problem within the link. It is because the image file is svg. I tried changing it to png and it works.

1 Like