reading a blob field into a string as base64

Does anyone know if it is possible to read a MYSQL blob field into a script in servoy as Base64.

Its a long story, but i need to embed an image into an XML string as <img src="data:image/jpg;base64,'+imagedataasbase64…

in order to send it to an external plugin to render it.

Because the plugin is using an external rendering engine then the servoy blobloader doesn’t work.

When you refer to a blob field, it obviously appears as an array rather than the actual string within the file.
Saw this on the web, but cannot translate the second line:

BLOB b = (BLOB)r.getBlob(‘ICON’);//BLOB is oracle type not Blob
byte base = b.getBytes();
Strgin res = Base64.encode(base);

Does anyone know how this can be done?

Thanks

David

Hi David,

You can use IT2Be’s free Cryptor plugin to base64 encode/decode anything.
Your code will look something like this:

var sBase64String = plugins.it2be_cryptor.Base64encode(BLOBdataProvider);

Hope this helps.