How to display images from BLOB column via APEX 4.0
Hello,
I did the following in order to display images of two Oracle records on the APEX page. I am using APEX Version : 4.0.1.00.03 , Oracle DB Version : 10.2.0.4.0.
1. Created An oracle table TEST_FORM
with 3 columns
( ID number, MIME_TYPE varchar2(255) , Image BLOB )
2. Inserted two records
10001, image/gif, ( actual image1)
10002, image/gif, ( actual image2)
3. created an Oracle procedure
CREATE OR REPLACE PROCEDURE show_my_form ( p_image_id IN test_form.id%type) AS
l_mime test_form.mime_type%type;
l_length NUMBER;
l_file_name VARCHAR2 (2000);
lob_loc test_form.IMAGE%type;
BEGIN
SELECT mime_type, IMAGE
, DBMS_LOB.getlength (IMAGE)
INTO l_mime, lob_loc, l_length
FROM test_form
WHERE id = p_image_id;
owa_util.mime_header(l_mime, false);
htp.p ('Content-length: ' || l_length);
owa_util.http_header_close;
wpg_docload.download_file (lob_loc);
END show_my_form ;
4. In Apex 4.0
step1. Created an interactive report on a new APEX page
step2. Specified the following in the Region Source
select id, mime_type, '<img src="#OWNER#.show_my_form ?p_image_id=#ID#" />' photo
from TEST_FORM
The column result shows as <img src="CCS.show_my_form?p_image_id=#ID#" />
I am unable to display the column image as a link to a proper image photo.
Could you please advise me if I missed anything ?
Thanks a lot.
Regards
Susanna
Edited by: user10318332 on 13/12/2010 15:51
Edited by: user10318332 on 13/12/2010 20:10
Maybe the space you have before the ? is causing issues. there shouldn't be any space.
Your procedure looks to be much the same of one that I have.
Have you granted execute on your procedure?
Also, what version DB are you running? This could be another issue: http://daust.blogspot.com/2006/04/xe-calling-stored-procedures.html
But anyway, you don't need to create your own procedure these days. You could do the following:
in your query, have a column: dbms_lob.getlength(blob) photo ; save, then in column attributes for that column, apply a format mask. There is usually a link below the text box for the format mask - BLOB Download Format Mask, which will help you build the format mask. But it is documented here: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/advnc.htm#BCGGJHEF
Ta,
Trent
Similar Messages
-
Problem Displaying image from blob
Hi all,
I m using,
Database : 10g Rel 2
Frontend : DevSuite 10g
OS : WinXp
Browser : IE 6
Problem : In my forms i m displaying images from blob column but some of the images are not displayed. I have tried with all image formats available in combination with all available display quality but no luck. What could be the reason for it and how do i solve it?
Can anyone help me plz?
Thnx in advance.
ImtiazHello,
It is very difficult for us to "guess" what images you can read and what others you cannot.
Maybe you could provide more information on images that are not displayed ?
What is their native format ?
Francois -
How to display image from wamp if the data type i use is blob?
please help me with the problem of displaying image from wamp if data type is blob. Thanks
Don't store the images in the database. Store the image file names in the database and put the images in a folder.
-
Hello.
Does anybody know, how to display image stored in BLOB column in some table?
Thanx.Hi Denes.
It looks like a good work but it doesnt work in my app. Everything is ok but image doesnt display.
html: <IMG src="APEX_WS.my_image_display" />
procedure:
CREATE OR REPLACE PROCEDURE APEX_WS.my_image_display
AS
l_length NUMBER;
l_file_name VARCHAR2 (2000);
lob_loc BLOB;
BEGIN
SELECT iblob, FNAME, DBMS_LOB.getlength (iblob)
INTO lob_loc, l_file_name, l_length
FROM MY_IMAGES_FROM_DISK
where date_time = (select max(date_time) from MY_IMAGES_FROM_DISK);
OWA_UTIL.mime_header ('image/'||regexp_replace(l_file_name,'(.*)\.(.*)','\2'), FALSE);
HTP.p ('Content-length: ' || l_length);
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (lob_loc);
END my_image_display;
table:
DNAME, FNAME, IBLOB, DATE_TIME
UTL_FILE,conditions.gif, BLOB, 21.8.2009
Where is the problem?:) Thanx. -
Display data from BLOB column.
Hi All,
I want to display data from blob datatype field, which contains HTML and GIF both files.
If I set it's property from file format IMAGE then i get data only gif.
if anybody have answer plz revert back...
awaiting...
JunedHi Juned
What I suggest is that you may have overlapping fields. One to show HTML and other to show GIF. You need to add one more column to your table in order identify if the BLOB is GIF or HTML.
In the Format Trigger of each of these two fields, inspect the value of flag column and hide one field if the datatype is not its type.
For instance, if flag field is 0 then hide Image field and show HTML field. If flag field is 1 then show Image field and hide HTML field.
Regards
Sripathy -
Display image from BLOB field (png image)
Hello,
On my database i have a function which return BLOB (png image from a webservice)..
Is there some tutorial or sample code how to display a image froma blob field in oracle reports?
thank youYou can create a view and base your report on that view. The view would be something like:
create or replace view my_view as
select my_blob_function() image
from ...In your Report it would just be:
select image
from my_viewNow, I'm not sure if Reports supports png format, though.
There are many examples to be found, e.g.
http://download.oracle.com/docs/html/B10602_01/orbr_dyngraph.htm -
How to load images from BLOB to javascript?
hi, Guys:
I need to load thumbnail images from BLOB to multiple markers' infowindow in Google map . I have implemented Google map in APEX. I load the data suchas text for every marker's infowindow from Oracle database table with PL/JSON, and infowindow works fine. Could anyone give me a suggestion or example so I know how to load images to javascript?
Thanks a lot.
Database: Oracle 11g R2
APEX: APEX 4.1
Thanks.
Samlxiscas wrote:
hi, VC:
Thanks for your kind reply. I need to render these images out of APEX session, actually in javascript that is related to Google map markers' infowindow.
I checked the documents of APEX_UTIL.GET_BLOB_FILE_SRC, but my impression is I need to use it in APEX instead of javascript if my understanding is correct. I already implemented a procedure with PL/SQL to load images from a BLOB column in Oracle database. But the problem is, how can I pass it to javascript code out of APEX to javascript (I could pass text or number from APEX to javascript with PL/JSON though,But I assume that still google map will be within a valid apex session? if so you should be able to use the above api.
Basically what this api does is generates a kind of url to each blob in the database, not sure how google api's deal with this though. Why don't you give it a try?
The other option is to make your pl/sql procedure public and then you can generate the json to include the images urls such as:
"employees" : [{
"firstName" : "John",
"lastName" : "Doe",
"imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
"firstName" : "Anna",
"lastName" : "Smith"
"imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
"firstName" : "Peter",
"lastName" : "Jones"
"imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
}And then you can use this new attribute to populate the images in javascript using standard img tag
See this tutorial http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/up_dn_files.htm
I did not find any method in PL/JSON to pass image object)? So far I only found example to load images from local files to javascript.Hmm..I don't think you should load image objects.
Vikram -
Apex 4.0 display image item :BLOB column returned by SQL statement
Hello
I'm creating an display image item in apex 4.0. The source is a BLOB column returned by SQL statement.
When I'm issuing an sql statement like this:
select lado.blob_content
from large_documents lado
, large_doc_headers ladh
where lado.ladh_nr = ladh.nr
more criteriait works fine.
When I create a function inside a package with the same query (in a cursor)
function get_image(some parameters in) return blob
Following in apex by:
select get_image(some parameters) from dualI get a
ORA-06502: PL/SQL: numeric or value error: character string buffer too smallAnybody any idea why this does not work?
Regards ErikHi Eric,
the environment assumes varchar2-output by default, which will be limited to 32767 characters and may have problems with binary formats. You could define a blob-variable to select the value into.
DECLARE
l_blob BLOB;
BEGIN
SELECT get_image(some parameters)
INTO l_blob
FROM dual;
END;
/If you expect the BLOB-Content to be text (you should consider CLOB then), you may use UTL_RAW.CAST_TO_VARCHAR2 to convert the content. If your object is larger than the maximum varchar2 size, or you want to convert BLOB to CLOB, you might be interested in some converter like described here: {message:id=559749}
Hope this is what you were searching for.
-Udo -
Retreving Image from Blob Columns in forms 6i
Hi
I inserted image into oracle database in an BLOB column Using Form6i. The table has only two columns, One is varchar2 and other is BLOB. The time it take for inserting image is very little, but retrieving from database to form is taking time. Can anybody suggest tips to improve the speed of retrieving?
Thanks in advance
Ahamed Rafeeque CHWhat are you doing exactly?
select blob_column
from my_tablewithout a WHERE clause retrieves all images. Yes, that may take some time. Be sure to add a WHERE clause. -
How to display image in blob field in ResultSet in SiteStudio?
I am running Site Studio 10gR4. For a custom page, I created a component that basically runs a query. The structure of the underlying data is a combination of Varchar2, Date and a single BLOB field. The blob field either contains a simple jpeg image, or nothing.
In my Page where I am looping through the data, how do I display the blob as an image?
Currently the code looks like this:
<!--$loop SQLRoutes-->
<tr>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 0))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 2))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 3))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 4))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 5))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></td>
</tr>
<!--$endloop-->Field 1 is a blob and fields 5 and 6 are dates.
So really two questions:
1. How do I display field1 as an image?
Example:
<!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))-->doesn't do it. Is there a different function then getValue() that I should be using to get the blob contents?
2. I want to compare the date fields to todays date, and either change the color or conditionally display the fields. I could do this with basic taglibs from jsp. How do I do this with IDocScript?
Example:
<!--$if getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6)) > dateCurrent-->
<span class="red"><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></span>
<!--$endif-->Thanks, KenI actually don't know the answer to #1. If I were to guess, there's nothing out-of-the-box to handle blobs, so your best option is to write your own idoc function. Take a look at the How To component if you don't know how.
For #2, you almost have it right. Insert bold:
<!--$if <b>parseDate(formatDate(</b>getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))<b>)) gt</b> dateCurrent<b>()</b>-->
<span class="red"><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></span>
<!--$endif--> -
Displaying image from BLOB from DB in Browser
I have a PL/SQL procedure to create a table with a BLOB image, mime type, key, etc. I can use another PL/SQL to load the images into the table. I have a PL/SQL procedure to get an image. I would like to call this procedure and pass the key parameter to display an image in a browser using HTML. Does anyone know how to do this?
Thanks.Use a java servlet to call your stored procedure (using jdbc), this will return the image as a java blob class. You can then write the java blob bytestream to the servlet response object, this should then appear in the browser.
-
Displaying Image from Blob as part of JSP
Hi All,
In our application we need to display a image as part of a JSP .The image comes as Blob from DB .we are able to save that image local file system but the image is not getting rendered on JSP.We tried converting the Blob to byte[] also.
we are using the following tag
<h:graphicImage value="#{beanName.property}" />
that bean property is a byte array.Hi,
We converted the Blob to byte array but even that does not seem to be working can anyone give the exact h:graphicImage tag that woorked without any servlet code to set it in response.
Its really urgent.
Thanks in advance -
How to display document from external archive via archivelink?
Hi,
I would like to display in SAP (via ArchiveLink) scanned document which was stored in an external archive (FileNet). The archive system is connected to SAP via ArchiveLink. However the scanned document isn't stored in the archive system via SAP so I don't know the ARCHIV_DOC_ID. I only know OBJECT_ID as far as the metadata of document is considered.
I tried to use ARCHIVOBJECT_DISPLAY function module with object_id and arvchiv_id but I get the message no. OA512 (Parameter info was not transferred for command docId). I can only display scanned document entering the right value of ARCHIV_DOC_ID parameter. But actually I don't know the value of this parameter from the level of SAP system.
Could anybody give me some clue or hints?
Best regards,
ZacariaHi
Just as Fred written SAP needs to be linked to external archiving system by a Contenent Repository (transaction OAC0).
The menu for ArchivLink setting is in customazing:
Was it done that?
Max -
How to display data from *.rtf file with apex in user-frienldy format?
Hello!
Well, in my database I have column "Problem" which type is CLOB, and there is text from some *.rtf file, e.g.
"{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset238{\*\fname Arial;}Arial CE;}{\f1\fmodern\fcharset238{\*\fname Courier New;}Courier New CE;}{\f2\fnil Arial;}} {\colortbl ;\red0\green0\blue0;\red0\green0\blue68;} \viewkind4\uc1\pard\cf1\lang1045\f0\fs20 Dla podanego poni\'bfej dokumentu XML zdefiniuj schematy XML (pliki XML-Schema), kt\'f3re pozwoli\'b3yby na jego walidacj\'ea. Przy definicji ka\'bfdego ze schemat\'f3w okre\'9cl jego nazw\'ea. \par \par \pard\cf2\b\f1 <?xml version="1.0" encoding="UTF-8"?> \par <s3:A1 xmlns:s1="udasie" xmlns:s2="czy" xmlns:s3="nie" \par xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \par xsi:schemaLocation="nie schemat3.xsd czy schemat2.xsd" \par C3="u"> \par \lang1033 <C3>d</C3> \par <B2>a</B2> \par <s1:A1 s1:A1="s"> \par \lang1045 <s1:B2>i</s1:B2> \par <s1:C3>e</s1:C3> \par <s2:B2> \par <A1>na pewno</A1> \par </s2:B2> \par </s1:A1> \par </s3:A1>\fs28 \par \pard\cf1\b0\f2\fs20 \par } ?
And the problem is:
in my APEX appliactions I only want to display this *.rtf text in user-friendly format (http://cerber.cs.put.poznan.pl/~inf71287/screen.png).
Is there any simple way to do this?
This is how it looks now: http://cerber.cs.put.poznan.pl/~inf71287/not_good.png - unreadable ;-)
Thanks for any suggestions :)
Buczuss
Message was edited by:
BuczussA new preference has been added to customize the import delimiter in main code line. This should be available as part of future release.
-
Display image from table!
Hi,
I have in my aplication a table user, where we can save is image:
t_user{id_user, name , adress..., foto(blob),foto_size(number),foto_name,foto_mime_type};
An user can upload his imageand save it in his table!
I wanted to display his image, but i onle found infomation how to show images saved in htmldb_application_files:
how to display image from tables?
Thank's in advanceLook at the sample application. It shows you how to do this
Maybe you are looking for
-
Intermittent lock screen PIN input on Yoga 13
About 1/3 of the time when I swipe the lock screen on the Yoga 13 to enter a PIN, I get a large touch screen PIN pad that pops up to touch the digits, which is the desired outcome. Why is it that the other 2/3 of the time there is no pop up and I mu
-
Hi Guys I am facing an error when uploading the items through Data Import. Just i am uplaoding only Item Code and Item Description . but error is coming like this " Row Number 1: Invalid Code [Items - Chapter ID] " Also when uploading the BP master d
-
Hi All, Is there any Function Module or standard report which will list out all the Status messages of an IDoc...Basically i need to capture all the segments which are in error state... In EDIDS table i am not able to link to a particular segment. Pl
-
Populate a Grid of calling form through called form.
hello, I need to call a form. Then select the rows through check box(called form) then have to populate them in a grid of calling form. Any ideas, how to do that..? Thanks..!
-
Screen icon flashes not getting recorded
Hi folks- I'm documenting how to use an ESRI ArcMap "computerized map" application. I'm making a Captivate demo of a few screen actions. When I go into record mode I do get the pull-downs and data entry actions in my demo, but one of the things I do