have a look at this post: How to set the image content of an image item - #2 by Wolfgang_S
It does not explain how to do the base64 encoding but describes how the content of the item has to be ‘formatted’ using a base64 encoded image.
The encoded image including mime type needs to be stored in memory not the URL.