Reputation: 5510
I am looking at sending myself some HTML from my server, I would like to know the best way to add image data into the HTML so that when I display the HTML in a UIWebview it displays like a normal webpage.
Their are two prerequisites 1, I do not want to store the images in the devices bundle 2, I don't want to have links to images hosted else where
I would like to know what formatting I need to use to (I.e. mime encoding etc) in order to read/display it in my UIWebview.
So if you old please give me some pointers on how to achieve this it would be very helpful as m just not 100% sure on where to begin and am finding examples few and far between.
Upvotes: 1
Views: 1057
Reputation: 2226
If you've got a base64 encoded image just use it directly in an image tag like this:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
Upvotes: 2