0

I have a html content

<div> <img src="xyz.jpg"> </div>

where an image is fetched from a web service in hex format. I am converting this hex format to jpeg and displaying in a div. But <img src=""> requires a source folder where the image will be stored. Since the data is coming from web service and is getting converted into jpeg and displayed in div I can't use <img src=""> tag. Do you know about other alternative to achieve this?

gbestard
  • 1,177
  • 13
  • 29
rampuriyaaa
  • 4,926
  • 10
  • 34
  • 41

2 Answers2

2

You can use Data URI:

<img src="data:image/png;base64,...">
Denis
  • 5,061
  • 1
  • 20
  • 22
0

you could do it with style and backgroundimage, like so:

   <div style="background-image:url(xyz.jpg);"></div>
goleon
  • 66
  • 6
  • url again checks for source url where the image is actually stored, but I am not storing the image anywhere..dynamically fetching hex format and displaying into UI.. – rampuriyaaa Apr 23 '14 at 11:37