Forum OpenACS Development: Displaying database BLOB image how?
So what is the correct way to retrieve and display these images on a webpage using OpenACS?
I see the portait-bits code but that is using content repository so no use.
Can the image be read into a variable as normal from DB query and just put on page using @image@ ?
If I have to include some program into an IMG tag like portrait-bits does it, then what are the OpenACS functions I need to use to send the image to browser?
However, html5 (and maybe html4?) and browsers support multiple content types in one page. This page shows an example:
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
and refers to other reference links.
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)
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: http://openacs.org/api-doc/proc-view?proc=db_blob_get&source_p=1 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: http://openacs.org/forums/message-view?message_id=88888