Insert image stored in database


#1

Hi,

Can one directly insert in a markdown document an image stored as a large object in a database?


#2

Some questions:
(1) in what format is the image stored?
(2) can the image be retrieved using an R script?
(3) what type of database is it?


#3

Hi @rich_i

Thanks for your reply.

Pictures are stored in an Oracle database as CLOB or BLOB objects.
Regarding (2), I have access to the database and am able to retrieve text/data files stored similarly to my image files directly from R scripts. So the connection is not a problem. The mechanism to extract data corresponding to image files and print them to a markdown document is the key problem.


#4

@pomchip

Hey, did you ever figure out how to insert BLOB images?


#5

Is it possible to write a reusable function based on your R scripts? In the single function, it might be possible to obtain the image from the database, store it to disk, convert the image to base-64 and include it in the R Markdown document (making it self-contained), and remove the image from disk.

If this sounds reasonable, I could provide some code for each of the parts.


#6

I do not have a working script at the moment. I would need to discuss with my DBA in order to create a function/procedure that would write the required images to file.