The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> can't get image to show up in gmail
farmerDan
post Jul 17 2024, 08:21 PM
Post #1





Group: Members
Posts: 3
Joined: 17-July 24
Member No.: 29,211



Hi, I am trying to send a email created in a bash shell script using curl, json, and html that will contain a gif logo. I was able to successfully send images (gif, png, jpg) as long as I used "C:\\\filename" from a Windows computer to Outlook. If I try to exec the same bash script and send to my gmail acct, the pics do not appear, just a little image box that does not expand even if I select Download Pic.
I am able to attach a gif to an email, and send it to my gmail acct from Outlook, and that works fine.
Just not sure what I am doing wrong in the shell script or what I need to change to make it work for all email providers.
I am using sendGrid to send the email.
The last part of my shell script:
"content": [{"type": "text/html", "value": "
<!DOCTYPE html>
<style>{font-family: Verdana,sans-serif !important;}
</style>
<body>
<p>Hi there,</b>
<p>Sincerely,
<br>Dan
<p>
<img src='HT2.gif' alt='mygif' style='display: block'>
<p>
<img src='file:///home/dan/HT2.gif' alt='dangif' width='500' height='300'>
</body>
</html>"}]}
EOF

Any help would be greatly appreciated. Thank you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Jul 18 2024, 02:03 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,996
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



If I understand correctly, Email you send to someone else can't get images from your personal computer. The image should reside somewhere on the web and the img src attribute should point to that web address.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 18 2024, 06:07 AM
Post #3


.
********

Group: WDG Moderators
Posts: 9,743
Joined: 10-August 06
Member No.: 7



QUOTE(CharlesEF @ Jul 18 2024, 09:03 AM) *

The image should reside somewhere on the web and the img src attribute should point to that web address.

Some users may block such images though, so make sure the email is functional even without the image.

Another options is to embed the image in the email as Base64 data: https://www.geeksforgeeks.org/how-to-displa...images-in-html/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
farmerDan
post Jul 19 2024, 12:40 PM
Post #4





Group: Members
Posts: 3
Joined: 17-July 24
Member No.: 29,211



QUOTE(Christian J @ Jul 18 2024, 06:07 AM) *

QUOTE(CharlesEF @ Jul 18 2024, 09:03 AM) *

The image should reside somewhere on the web and the img src attribute should point to that web address.

Some users may block such images though, so make sure the email is functional even without the image.

Another options is to embed the image in the email as Base64 data: https://www.geeksforgeeks.org/how-to-displa...images-in-html/

i will try the base64 technique. thanks for the response.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
farmerDan
post Jul 19 2024, 12:42 PM
Post #5





Group: Members
Posts: 3
Joined: 17-July 24
Member No.: 29,211



QUOTE(CharlesEF @ Jul 18 2024, 02:03 AM) *

If I understand correctly, Email you send to someone else can't get images from your personal computer. The image should reside somewhere on the web and the img src attribute should point to that web address.

Not really sure where I would put the image on the web, but I did get an image to display by doing just what you said. I just picked some random pic (think it was a light bulb), and used the URL and it did display. The rest of the email is being generated correctly and does display. thanks.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
coothead
post Jul 19 2024, 04:08 PM
Post #6


Advanced Member
****

Group: Members
Posts: 234
Joined: 12-January 23
From: chertsey, a small town 25 miles south west of london, england
Member No.: 28,743



Hi there farmerDan,

Do you not know how to Convert your HT2.gif image to Base64 format?

coothead
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 11th December 2024 - 12:04 PM