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 Erik
Hi 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
Similar Messages
-
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:10Maybe 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 -
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 resize display image item?
How to resize an image in display image item not in column?
I find a way to resize it in column which similar to this way
decode(nvl(dbms_lob.getlength(PLAYER_PIC),0),0,null,
'<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius:
4px;" '||
'src="'||
apex_util.get_blob_file_src('P5_PLAYER_PIC',ROWID)||
'" height="75" width="75" alt="Player Image" title="Player Image" />')
detail_img
but when I try to implement it to display image item which I returned the image from the column, I cant resize it this way, or may be I used wrong syntax, can you please help me finding way to resize it with steps?I guess it is because of some carriage returns in your dynamic img tag that is being generated may be not, so make sure there are no breaks half-way through he attributes of the img tag.
decode(nvl(dbms_lob.getlength(PLAYER_PIC),0),0,null, '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '|| 'src="'|| apex_util.get_blob_file_src('P5_PLAYER_PIC',ROWID)|| '" height="75" width="75" alt="Player Image" title="Player Image" />') detail_imgand also inspect the element/img to see if the code is rendered correctly
Thanks -
Refresh display image item without reload page
hi all, is a way to refresh (requery) a display image item to change the image via botton and do not reload page ?
thanks
Edited by: Reza.Gh. on Sep 24, 2012 11:56 AMI create a sample app :
https://apex.oracle.com/pls/apex/f?p=9310:1
code of item P1_CAPTCHA_IMG :
SELECT captcha_img FROM captcha WHERE response = :P1_CAP_V;
item P1_CAP_V code (computations) :
SELECT *
FROM (
SELECT response
FROM captcha
ORDER BY
dbms_random.value
WHERE rownum = 1 ;
Refresh botton code :
action 1 :
SELECT * into :P1_CAP_V
FROM (
SELECT response
FROM captcha
ORDER BY
dbms_random.value
WHERE rownum = 1;
action 2:
refresh item P1_CAPTCHA_IMG -
Cannot Upload or Display Image in blob Item.
Hi Guyz,
I'm inserting a image in a blob item using oracle forms 10g and database 9i, everything is working fine except uploading image, i tried the below code it was opening file Open dialog and as soon as i select the image to insert into the image item it will not shown anything at all in image item.
WBP trigger code.
[code]
DECLARE
FILENAME VARCHAR2(256);
BEGIN
FILENAME := WEBUTIL_FILE.FILE_OPEN_DIALOG();
IF FILENAME IS NOT NULL THEN
CLIENT_IMAGE.READ_IMAGE_FILE(FILENAME,SUBSTR(FILENAME,INSTR(FILENAME,-1)),'MN_PICTURES.PICTURE');
:MN_PICTURES.PIC_STAT:=1;
END IF;
END;
[/code]
then i tried new thin from scratch using the below link to insert the code but still same i cannot insert image into the image item i set the below properties in image item
Baig's Technology Blog: Storing and Retrieving Images / Word / Excel / PDF and Movies in Oracle Database using Forms10g
sizing style=Adjust
Image format= TIFF.
any patch required or i'm doing something wrong?
Regards
Moazamhey guyz,
I found the solution on below link...thx
https://forums.oracle.com/thread/2190302
Regards
Moazam -
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 in datagrid column
I have a datagrid with a column that displays true or false
if an item "has children" or not. How would I go about placing an
image in the column depending on the value of the column. I want to
have two different images one for false and one for true.make your item renderer a canvas, with 2 images.
when your canvas loads, you have the 'data' of that cell. So
lets say your column's datafield is "hasimage", you can do
something like this:
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="created();">
override public function set data(value:Object):void
if(value != null)
super.data = value;
public function created():void
if(data["hasimage"] == "true")
trueImg.visible = true;
else
falseImg.visible = true;
<mx:Image id="trueImg" src="image" visible="false" />
<mx:Image id="falseImg" src="image" visible="false" />
</mx:Canvas> -
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. -
Images in Blob Column..
Hi
I have a function that retrieves the blob column which has the image data. I cannot view this from Toad and get the value {hugeBLOB} when I query via Toad.
I used it in a VB.Net app, but I'm unable to reterive the image there also. Can you please suggest how I can retrieve blob column (which has images) into a .jpg format? I need to retreive the images based on the query.
Thanks for all suggestions.
ASRHi,
Your question is not according to Forum. You must post your thread (for immediate response) on Oracle Forum for Dot Net/VB Forum.
But i'm going to accept your request.
I've inserted/ saved image in oracle 9i database. And As well i've read/displayed image into Picture Control from Oracle9i database.
But i've used C# Dot Net (Visual Studio 2005 Professional) as front hand tool.
Sorry for VB. One thing IMPORTANT:
I'm going mention code in C# you can Covert into VB Dot Net. Through Online FREE Compiler(www.developerfusion.co.uk/ and click on utilities.)
--------------------------------Here Below is C# Code ----------------------------------------------------
Con.Open();
string myquery = "Select Form_id,Emp_image From Employee where Form_id=2840";
OracleCommand cmd = new OracleCommand(myquery, con);
OracleDataReader dr = cmd.ExecuteReader();
Boolean recordExist = dr.Read();
if (recordExist)
//Now displaying Picture.
MessageBox.Show("Pic is being loaded by C#. Now");
OracleLob blob = dr.GetOracleLob(1); //Column #, Emp_image
Byte[] BLOBData = new Byte[blob.Length];
//Read blob data into byte array
int i = blob.Read(BLOBData, 0, System.Convert.ToInt32(blob.Length));
//Get the primitive byte data into in-memory data stream
MemoryStream stmBLOBData = new MemoryStream(BLOBData);
//LOADING INTO PICBOX1
Picbox1.Image = Image.FromStream(stmBLOBData);
MessageBox.Show("Now i'm reseting it.");
Picbox1.SizeMode = PictureBoxSizeMode.StretchImage;
Else
MessageBox.Show("Reocrd not found against this id.");
Hopefully it helps you. If it is still difficult to understand don't shy to make query.
--- -
Displaying image in BLOB via pl/sql cartridge
Hi gurus ,
I have a oracle web site. I am dynamically putting links in the page using pl/sql cartridge and procedures. I have loaded all my pictures for the catalog in the BLOB columns. Can anyone help me or direct me how to display these images using plsql cartridge dynamically from BLOB columns instead of from image files ???
nullOriginally posted by Dan Mullen:
I'm not familiar with the PL/SQL cartridge.
Since this is the interMedia forum my suggestion would be to store the image data in an ORDImage column and use the interMedia WebAgent to retrieve the data.
The interMedia WebAgent can be used with "naked" blobs but you'll need to code your own pl/sql routines (the code wizard won't do it for you).
The code wizard does generate procedures for OrdImages but due to some reasons the GET_XX procedures don't work and give the error "ORA-04043 Object Get_Image does not Exist <br><br>"
null -
Hi,
How can i insert a image/largefile into table (having BLOB column) from sql plus?
ThanksHi!
Do this with PL/SQL.
CREATE TABLE image_tbl
filename VARCHAR2(4000),
image BLOB
DECLARE
v_blob BLOB;
v_srcfile BFILE;
BEGIN
DBMS_LOB.CreateTemporary(v_blob, TRUE);
DBMS_LOB.Open(v_blob, dbms_lob.Lob_ReadWrite);
v_srcfile := Bfilename('IMAGE_DIR', 'image.gif');
DBMS_LOB.FileOpen (v_srcfile, dbms_lob.File_ReadOnly);
DBMS_LOB.LoadFromFile(v_blob, v_srcfile, DBMS_LOB.GetLength(v_srcfile));
INSERT INTO image_tbl (filename, image)
VALUES ('image.gif', EMPTY_BLOB());
UPDATE image_tbl
SET image = v_blob
WHERE filename LIKE 'image.gif';
DBMS_LOB.FileClose(v_srcfile);
COMMIT;
END;I hope that one will help you.
yours sincerely
Florian W. -
Hi,
I have to display only images on a web page in JSF2.0 in Netbeans. I am using datatable and column to do so. But there is one problem.
All images are display only in single column(i.e. vertically). I want to display in rows and columns not only column.
e.g. One row will have atleast 3 images and more rows like this.
Which attribute should i use of datatable? or should i use some other tag?
My code is:
<h:dataTable var="images"
value="#{jsfMBean.allImages}"
rules="none"
cellpadding="20"
border="0" >
<h:column>
<h:graphicImage value="faces/WEB-INF/upload/#{images.picid}" width="300px" height="100px" />
</h:column>
</h:dataTable>
Thanks.
NetBeans 6.9.1
JSF 2.0 with facelets
glassfish 3.0
Enterprise java beans
PrimeFaces 3.0I believe you are looking for the panelgrid, not the datatable.
Note that there are a few useful websites online that list the available JSF tags plus their properties, such as these:
http://www.horstmann.com/corejsf/jsf-tags.html
http://www.exadel.com/web/portal/jsftags-guide -
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 -
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.
Maybe you are looking for
-
I need help with at I can't use my iMessage with my iPod touch it won't let me . Can you please help me fix this?
-
Is there a way to create a role like DBA role?
is there a way to create a role just like DBA role?
-
Sales Order document Flow in Reports
Hi All, I am develoing a Custom Sales Order report in ALV. Here the requirement is to include the Document Flow for the line item. This should be similar to the Icon in VA03 transaction. When I click this icon in my report, it should display the d
-
I AM INSTALLED HP PSC 1410 ALL IN ONE SOFTWARE (AROUND 382 MB) BY DOWN LOADING FROM HP SITE. BUT I CAN'T TAKE PRINT. PRINTER DRIVER NOT INSTALLING.!! I CAN SCAN AND COPY. FROM THE SYSTEM oPERATING SYSTEM : WINDOWS 7 PROFESSIONAL PRODUCT NO " HP PS
-
What is defference between updating Firmware via P...
I'm N85 user and I want to know What is defference between updating Firmware via PC an Via Device manager on phone?