Skip to main content

Hello everyone,

I am storing a range of base64 PNG images as blobs in an Oracle Table.

 

As part of a separate process, I want to read these images from Oracle and use them in an HTML report.

 

What I am noticing is the attribute being written to Oracle is different to what is being returned from Oracle.

 

Attributes when written to OracleimageAttribute from Oracle

imageWhat do I need to do to read / write the image so I can use the Base64 version as an attribute in the HTML writer?

 

 

Any particular reason for base64-encoding the images before storing them in the BLOB? Why not simply store the binary file in the BLOB directly, without having to go through base64?


Any particular reason for base64-encoding the images before storing them in the BLOB? Why not simply store the binary file in the BLOB directly, without having to go through base64?

Good question @david_r​ and the main reason is that I am using base64 in my HTML for example

 

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4

//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

 

So I want to be able to use the attribute

 

<img src="data:image/png;base64,@value(RasterBlob)" alt="Red dot" />

 

 

 


Good question @david_r​ and the main reason is that I am using base64 in my HTML for example

 

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4

//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

 

So I want to be able to use the attribute

 

<img src="data:image/png;base64,@value(RasterBlob)" alt="Red dot" />

 

 

 

I would still just store the PNG as-is in the BLOB, then convert it to base64 at the last minute when generating the html.

BLOB is a binary data type, so it makes sense to store binary data, such as the PNG file contents, in it. Base64 is a text format, so it would be easier to simply store it as a CLOB in Oracle, rather than a BLOB.


Good question @david_r​ and the main reason is that I am using base64 in my HTML for example

 

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4

//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

 

So I want to be able to use the attribute

 

<img src="data:image/png;base64,@value(RasterBlob)" alt="Red dot" />

 

 

 

Thanks again, I will give that a go :)


Reply