4

I am getting the base 64 string in my email but i need to make it is visible as an image to the users. The image will not be static for all the users

user2477454
  • 41
  • 1
  • 3

2 Answers2

4

You can specify the source of an image using base64 data, such as below.

<img src="data:image/gif;base64,INSERTBASE64STRINGHERE"/>

Whether this will work in all email clients, I'm not sure. The client may still need to click 'show below images', or a similar button in order for the images to display.

An example using Googles logo can be seen here: http://jsfiddle.net/vLM7s/

It was converted using the tool at http://webcodertools.com/imagetobase64converter/Create

Seidr
  • 4,946
  • 3
  • 27
  • 39
  • there is no image coming in the body of the email...moreover i need where i can make the base 64 string to image generic – user2477454 Jun 27 '13 at 10:08
2

You just need to enter the base64n encoding text in SRC attribute of the IMG tag like this

<img src="data:image/png;base64,(YOUR BASE 64 STRING HERE)" />
MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125
  • there is no image coming in the body of the email – user2477454 Jun 27 '13 at 10:05
  • please provide a fiddle of what you are doing – MaVRoSCy Jun 27 '13 at 10:14
  • and a link to the actual picture – MaVRoSCy Jun 27 '13 at 10:15
  • i cant give the actual image as there is some limitation over the char. – user2477454 Jun 27 '13 at 10:22
  • paste the code here http://jsfiddle.net/FuaZ3/ and press update and share the link – MaVRoSCy Jun 27 '13 at 10:26
  • Looks good to me, it should also work in your email client. Check the settings in your email client about displaying images... – MaVRoSCy Jun 27 '13 at 10:38
  • i need to make the image generic in my code...i.e., every time in the email the image should change from base 64 string to image...can u help in this using html code – user2477454 Jun 27 '13 at 10:40
  • Not following you. Please update your question with more details on what EXACTLY do you want to achieve – MaVRoSCy Jun 27 '13 at 10:43
  • i am using smtp clicnt to send the emails to the customers about there custom tshirt,shoes,etc.the same image is stored in a binary format in the database.now evry time an order is completed we send an email to cust to view there products...and we want it to be in the email content as customer may want to share the image on social media like facebook – user2477454 Jun 27 '13 at 10:48
  • OK, go on, create a new question, explain your problem thoroughly, explain what tools do you use for creating the email , technologies etc.... – MaVRoSCy Jun 27 '13 at 10:52