I've been trying to output BLOBs in my PDF reports using Oracle BI Publisher as my printing server. I have no issues with really small images but when the image size increases I get no output. I'm using the method proposed in this blog post : https://blogs.oracle.com/xmlpublisher/entry/inserting_blobs_into_your_repo
I noticed Scott Wesley had also faced the same issue. This is the table I'm using to keep my images stored in :
CREATE TABLE MY_IMAGES (
ID NUMBER NOT NULL,
IMAGE BLOB,
FILE_NAME VARCHAR2(50),
MIME_TYPE VARCHAR2(30)
);
/
I'm using Tim Hall's function to encode the BLOB column to Base64 :
CREATE OR REPLACE FUNCTION base64encode(p_blob IN BLOB)
RETURN CLOB
-----------------------------------------------------------------------------------
- File Name : http://oracle-base.com/dba/miscellaneous/base64encode.sql
- Author : Tim Hall
- Description : Encodes a BLOB into a Base64 CLOB.
- Last Modified: 09/11/2011
-----------------------------------------------------------------------------------
IS
l_clob CLOB;
l_step PLS_INTEGER := 12000; - make sure you set a multiple of 3 not higher than 24573
BEGIN
FOR i IN 0 .. TRUNC((DBMS_LOB.getlength(p_blob) - 1 )/l_step) LOOP
l_clob := l_clob || UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode
(DBMS_LOB.substr(p_blob,
l_step, i * l_step + 1)));
END LOOP;
RETURN l_clob;
END;
This is my select statement as my Report Query :
SELECT FILE_NAME, BASE64ENCODE(IMAGE)
FROM MY_IMAGES
And in my RTF Report Layout I'm using this code to render the encoded BLOB :
<fo:instream-foreign-object content-type="image/jpg">
<xsl:value-of select="IMAGE"/>
</fo:instream-foreign-object>
I inserted a 5KB image in the table and it's working perfectly, but when I tried with a 500Kb image, there was no result. I was wondering whether anyone had come up with a solution, or if this issue was solved. I'm on APEX 5.1 on an 11g Database and using BI Publisher 11g. I appreciate any help in advance.