BLOB Images in XML Publisher
Posted May 21, 2009on:
BLOB is “a collection of binary data stored as a single entity in a database management system. Blobs are typically images, audio or other multimedia objects, though sometimes binary code is stored as a blob. Database support for blobs is not universal.” (wikipedia)
Support for extracting BLOB images to XML is coming, the XMLP extraction engine will extract the images and encode to base64 in the XML, you will then be able to pull this into the output via the RTF template.
Following are something that you should know:
- Can’t generate xml data for CLOB more than 40 kb in report builder.
- BLOB Images are supported in XML Publisher 5.6.2 or later.
- Encode BLOB to CLOB use this following function:
CREATE FUNCTION getbase64( p_source BLOB )
DBMS_LOB.createtemporary(lob_loc => v_result, CACHE => FALSE, dur => 0);
Wf_Mail_Util.EncodeBLOB ( p_source, v_result);
RETURN ( v_result );
- To show BLOB Images use the following code:
<fo:instream-foreign-object content-type=”image/jpg”><xsl:value-of select=”.//IMAGE_”/></fo:instream-foreign-object>
- XML Publisher supports in general right now only JPG, GIF and PNG.
Notice the template needs to know the mime type of the image, in this case “image/jpg” The IMAGE_ contains the base64 encoded image data. Template and sample data here (remove the extension .odt )