Need code snippet: import mesh/texture into content browser from C++ code.

Encoding in-memory image data into any file format in order to create a texture is almost certainly the wrong way to do it.

In 3 seconds google search located this:
https://wiki.unrealengine.com/Dynamic_Textures

Is this what you wanted?