Forum OpenACS Development: Re: Displaying database BLOB image how?

Posted by Benjamin Brink on
Per html3ish.. images needed to refer to a url in an IMG tag:

However, html5 (and maybe html4?) and browsers support multiple content types in one page. This[1] page shows an example:

<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

and refers to other reference links.



Posted by Gaven Eogan on
thanks for your reply.

Interesting. I didn't know that BLOBS were returned as base64 from the database.

Actually I was just trying to find what OpenACS functions could be used to actually return the BLOB data back to the IMG inside the page. I did see that people use small includes inside the image tag and the include program does a "cr_write_content" call but that only works when the image is stored in the conent resository.

I was just trying to find the equivalent function to return a BLOB back to the browser in an include.

But I gave up and went back to using the content repository and its functions after figuring out how to make or use my data as an object (that was why i couldn't use it before)

Posted by Benjamin Brink on
I haven't used blobs myself.

I'm not sure if an image blob is in base64. In email, images can be base64.

There's a db command in api called db_blob_get: It states it's 'PostgreSQL only.' but the source shows code for oracle as well. Maybe it's buggy.

Maybe this thread has something useful: