How to display BLOB image column with WEB application, JSF, ADF BC
I looking for a way to display the content from a blob column on a WEB application, JSF, ADF BC
The blob column contains a JPEG image.
About the application
The model contains a viewobject where the blob column attribute (photoimg) type is of type : BlobDomain
Now I have to create the view to display the content of photoimg inside a JSF-JSP page.
Any advice ?
Search is your friend
How to display the content of a BLOB column in a ADF/BC pages ?
John
Similar Messages
-
Display BLOB (image) column in (interactive) report
Hi,
I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
i have also modified the BLOB display format as per
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
what i am missing is the correct query. if possible, i would like to control the size of the picture rendered within the report like say 40*50.
I have also referred to the thread
APEX 3.1 Display BLOB Image
But i don't know how to place the
dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
in my query.
The above also makes the report column as of type "number". is this expected?
Any help would be much appreciated.
Regards,
RamakrishnanYou haven't actually said what the problem is?
>
I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
i have also modified the BLOB display format as per
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
what i am missing is the correct query.
I have also referred to the thread
APEX 3.1 Display BLOB Image
But i don't know how to place the
dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
>
Something like:
select
name
, description
, dbms_lob.getlength(picture) picture
from
details
if possible, i would like to control the size of the picture rendered within the report like say 40*50.For images close to this size it's easy to do this for declarative BLOB images in interactive reports using CSS. Add a style sheet with:
.apexir_WORKSHEET_DATA td[headers="PICTURE"] img {
display: block;
width: 40px;
border: 1px solid #999;
padding: 4px;
background: #f6f6f6;
}where the <tt>PICTURE</tt> value in the attribute selector is the table header ID of the image column. Setting only one dimension (in this case the width) scales the image with the correct aspect ratio. (The border, padding and background properties are just eye candy...)
However, scaling large images in the browser this way is a huge waste of bandwidth and produces poorer quality images than creating proper scaled down versions using image tools. For improved performance and image quality, and where you require image-specific scaling you can use the database ORDImage object to produce thumbnail and preview versions automatically, as described in this blog post. -
How to get blob image width with ordimage?
Hello,
I have trouble getting image width with ordimage. I have quite the same program for processing images as here: http://spendolini.blogspot.com/2005/10/manipulating-images-with-database.html
so I have declared image files as BLOB files. How can I get the width for the them?
There is a sample from ordimage reference:
DECLARE
image ORDSYS.ORDImage;
width INTEGER;
BEGIN
SELECT p.product_photo INTO image FROM pm.online_media p
WHERE p.product_id = 3515;
-- Get the image width:
width := image.getWidth();
DBMS_OUTPUT.PUT_LINE('Width is ' || width);
COMMIT;
END;
the ORDSYS.ORDIMAGE is used instead of BLOB here. when i do the same then i can't select BLOB content into the ORDSYS.ORDIMAGE variable. And otherwise I can't use the getWidth with the BLOB variable.
Can anybody help please?Hi,
the column blob_content is not suitable for storing into v_image2 because variable v_image2 is of type ORDSYS.ORDIMAGE and the column is BLOB.
I used the following method instead:
declare
image blob;
attributes clob;
img_mimeType varchar2(32);
img_width integer;
img_height integer;
img_contentLength integer;
fileFormat varchar2(32);
contentFormat varchar2(32);
compressionFormat varchar2(32);
begin
DBMS_LOB.CREATETEMPORARY(attributes, TRUE, DBMS_LOB.CALL);
select img
into image
from image_repository
where id = 0;
ORDSYS.ORDImage.getProperties(image,
attributes,
img_mimeType,
img_width,
img_height,
fileFormat,
compressionFormat,
contentFormat,
img_contentLength);
dbms_output.put_line(img_mimeType);
dbms_output.put_line(img_width);
dbms_output.put_line(img_height);
dbms_output.put_line(fileFormat);
dbms_output.put_line(compressionFormat);
dbms_output.put_line(contentFormat);
dbms_output.put_line(img_contentLength);
DBMS_LOB.FREETEMPORARY(attributes);
end;
try adapting this code and think about the possibility of "caching" image properties, because it takes some time to retrieve them every time.
Bye,
Flavio
http://oraclequirks.blogspot.com/search/label/Apex -
How to display BLOB images from the Oracle database within Crystal
Let's say a have the following table
IMAGES
========
DOC_ID NUMBER
DOC_NAME STRING
DOC_IMAGE BLOB
The BLOB field can have any type of document: PDF, email, WORD, EXcel, etc. I would like to present the DOC_ID and DOC_NAME and let the user click any of them. Once the user clicks the document stored in the database as BLOB, it is rendered using the default application associated to the extension. For example if the file name is ABC.XLS open MSExcel if the file is abc.pdf open Acrobat.
I am using Crystal2008 and evaluating Crystal 4.0
Does this requires programming?
Thanks!!!Hi
Crystal is a reporting tool and you canu2019t execute any code except free hand SQL. When you pull any BLOB fields in crystal, it takes as a picture field and if that field contains image only it will display in your report.
If you have any information other than image, it will not display any info in the report.
If you want to insert Word , PDF and Excel then you will have to insert as ole object and can manage with location of the files.
Thanks,
Sastry -
How to display single row column with nested group function
SQL> select deptno, Max(sum(sal)) SalSum
2 from emp
3 group by deptno;
select deptno, Max(sum(sal)) SalSum
ERROR at line 1:
ORA-00937: not a single-group group function
Can you please the Help me to get the Max(sum(sal)) with Deptno ......select deptno, sum(sal) SalSum
from emp
group by deptno;The ablove query will give only one value for SALSUM for a department. So there is no meaning on applying MAX on this for a department..
What are you trying to achieve?
This?
select max(salsum) salsm,max(deptno) keep(dense_rank first order by salsum desc) deptno
from(
select deptno, sum(sal) SalSum
from emp
group by deptno);Edited by: jeneesh on Sep 4, 2012 6:00 PM -
Problem with displaying BLOB images on JSP page using a servlet
hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
here is one of my image servlet's working versions (the essential part of it) :
BLOB blob=null;
rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
while (rset.next())
blob=((OracleResultSet)rset).getBLOB(2);
response.reset();
response.setContentType("image/jpeg");
response.addHeader("Content-Disposition","filename=42.jpeg");
ServletOutputStream ostr=response.getOutputStream();
InputStream istr=blob.getBinaryStream(1L);
int size=blob.getBufferSize();
int len=-1;
byte[] buff = new byte[size];
while ((len=istr.read( buff ))!=-1 ) {
ostr.write(buff,0,len);
response.flushBuffer();
ostr.close(); and my JSP page code :
<img src="/ImageServlet" border="0" > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
here's the magic tag : <img src="ImageJSP.jsp" border="0" > enjoy : ) -
Displaying BLOB image by using ADF Faces
Hi all,
I digged the forum but couldn't find any satisfied answer about displaying BLOB images by using ADF Faces.
I have insterted POJO object to Oracle database but couldn't find any way to display blob (in java byte [] ) data in POJO.
I have read the POJO object from database which contains two field; one of them is id field and other is BLOB data which holds GIF or JPG image and I want to display this image another page which contains also other fields / records ...
thanks for your answers
regards...
--barisThis thread at Sun : http://forum.java.sun.com/thread.jspa?threadID=513804&messageID=2445090
talks about two options for creating a graphicImage jsf tag. (img tag)
1. Make the img tag url refer to a servlet (instead of a static image file)
2. Embed the image into the tag as inline base64 encoded data.
2a. Use an <Object> tag with inline data.
1. Looks a bit complex for a simple problem.
2 and 2a don't work with some browsers.
- And I've not yet figured out how to hook into the ADF Faces table-rendering logic to get it to add my image column. My table binds to a collection DataControl, [which in turn retrieves from a findAllItems call on a session facade, which uses my domain model, and wraps up access to a TopLink pesistence layer]. The framework just ignores my byte[] attribute when creating the jsf table from the DataControl. All string, int etc. attributes get represented correctly in the jsf table output. -
How to Display an Image on my FORM
Good Day!
I would like to ask some help from you guys with my problem on how to display an image on my form. I would like to display my uploaded image on my form but instead of an image, the get_blob_file is showing. By the way, I'm using Apex 4.1
I downloaded the Order Entry Sample Application and followed the Page 6, the Product Details. I even made snapshots of each details from Page Rendering to Page Processing in order not to miss a thing.
At the moment, I was able to upload or store the image on my created Oracle table and also able to retrieve it on the Download Link Text with Content Disposition value of Inline, provided by APEX Settings. If I invoke the Download link beside the file browser, a page with the image will be shown, below is the address:
http://127.0.0.1:8080/apex/apex_util.get_blob_file?a=200&s=339877802936975&p=230&d=7107921433296839&i=7107601420296838&p_pk1=54&p_pk2=&p_ck=7D6512D967336C4B94258EEA3CDF1BE6&p_content_disposition=inline
However, instead of showing the image on a region, below is the one showing on my Form:
<img src="apex_util.get_blob_file?a=200&s=339877802936975&p=230&d=7107921433296839&i=7107601420296838&p_pk1=54&p_pk2=&p_ck=7D6512D967336C4B94258EEA3CDF1BE6" />
As you can see the parameter values are the same but I know I missed something that's why I'm here :)
I would highly appreciate all the help you can provide and many thanks in advance.
I tried to change gear by making an html region of type PL/SQL (anonymous block) and a procedure but still no image :(
Below are the scripts.
declare
cursor cur is
select *
from wsemployee
where empid = :P230_EMPID;
begin
for rec in cur
loop
IF rec.mime_type is not null or rec.mime_type != '' THEN
htp.p( '<img src="my_image_display?p_image_id='||NVL(rec.empid,0)||'" height="'||100||'"/>' );
else
htp.p( 'No Image ');
END IF;
htp.p( ' ');
end loop;
end;
PROCEDURE
create or replace PROCEDURE my_image_display( p_image_id IN NUMBER)
AS
l_mime VARCHAR2 (255);
l_length NUMBER;
l_file_name VARCHAR2 (2000);
lob_loc BLOB;
BEGIN
SELECT MIME_TYPE, PHOTO_BLOB_CONTENT, PHOTO_FILENAME,DBMS_LOB.GETLENGTH(photo_blob_content)
INTO l_mime,lob_loc,l_file_name,l_length
FROM wsemployee
WHERE empid = p_image_id;
-- set up HTTP header
-- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
owa_util.mime_header( nvl(l_mime,'application/octet'), FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || l_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(l_file_name,instr(l_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
END my_image_display;
Edited by: user13831927 on Dec 22, 2012 3:24 PMHi Ying,
you can add a UDF to the table spp2 with a programm
but the table is not yet listed in the 'Manage User Fields' form.
there's no way to "enable" it - sorry -
How to show BLOB type Column ? In XE
How to show BLOB type Column as image in APEX report area? (In XE)
I did it with the following procedure
create or replace PROCEDURE MY_IMAGE_DISPLAY (p_image_id IN NUMBER)
AS
l_mime VARCHAR2 (255);
l_length NUMBER;
l_file_name VARCHAR2 (2000);
lob_loc BLOB;
BEGIN
SELECT 'JPEG', MLOGO, 'IMAGE', DBMS_LOB.getlength (MLOGO)
INTO l_mime, lob_loc, l_file_name, l_length
FROM CARS_TABLE
WHERE M_ID = p_image_id;
OWA_UTIL.mime_header (NVL (l_mime, 'application/octet'), FALSE);
HTP.p ('Content-length: ' || l_length);
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (lob_loc);
END my_image_display;
GRANT EXECUTE ON my_image_display TO PUBLIC;
and executed the following command
CREATE PUBLIC SYNONYM my_image_display FOR shema_name.my_image_display;
but under XE , I can not see synonym? why?sakrami,
Your question really belongs in the XE forum:
Oracle Database Express Edition (XE)
I think this posting addresses your question:
Re: Handling of pictures changed? Item values not properly updated in Beta
Joel -
I want to display BLOB image in JSP Using html tags IMG src=
GoodAfternoon Sir/Madom
I Have got the image from oracle database but want to display BLOB image using <IMG src="" > Html tags in JSP page . If it is possible than please give some ideas or
Send me sample codes for display image.
This code is ok and working no problem here Please send me code How to display using html tag from oracle in JSP page.
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="javax.swing.ImageIcon;" %>
<%
out.print("hiiiiiii") ;
// declare a connection by using Connection interface
Connection connection = null;
/* Create string of connection url within specified format with machine
name, port number and database name. Here machine name id localhost
and database name is student. */
String connectionURL = "jdbc:oracle:thin:@localhost:1521:orcl";
/*declare a resultSet that works as a table resulted by execute a specified
sql query. */
ResultSet rs = null;
// Declare statement.
PreparedStatement psmnt = null;
// declare InputStream object to store binary stream of given image.
InputStream sImage;
try {
// Load JDBC driver "com.mysql.jdbc.Driver"
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
/* Create a connection by using getConnection() method that takes
parameters of string type connection url, user name and password to
connect to database. */
connection = DriverManager.getConnection(connectionURL, "scott", "root");
/* prepareStatement() is used for create statement object that is
used for sending sql statements to the specified database. */
psmnt = connection.prepareStatement("SELECT image FROM img WHERE id = ?");
psmnt.setString(1, "10");
rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
int size=0;
sImage = rs.getBinaryStream(1);
//response.reset();
response.setContentType("image/jpeg");
while((size=sImage.read(bytearray))!= -1 ){
response.getOutputStream().write(bytearray,0,size);
catch(Exception ex){
out.println("error :"+ex);
finally {
// close all the connections.
rs.close();
psmnt.close();
connection.close();
%>
ThanksI have done exactly that in one of my applications.
I have extracted the image from the database as a byte array, and displayed it using a servlet.
Here is the method in the servlet which does the displaying:
(since I'm writing one byte at a time, it's probably not terribly efficient but it works)
private void sendImage(byte[] bytes, HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletOutputStream sout = response.getOutputStream();
for(int n = 0; n < bytes.length; n++) {
sout.write(bytes[n]);
sout.flush();
sout.close();
}Then in my JSP, I use this:
<img src="/path-to-servlet/image.jpg"/>
The name of the image to display is in the URL as well as the path to the servlet. The servlet will therefore need to extract the image name from the url and call the database. -
Displaying blob image using adf
Hi ,
We are using adf in our application. We have to disaply blob image from oracle data base on the adf jspx page.This jspx page consists of 2 jsff files.
I have created an httpservlet and called on the source parameter of image this httpservlet with binding similar as below:
source="/httpServletName?id=#{bindings}}"
I am able to display the image.
But my concern is that I am using iterator for displaying images as there can be multiple records in the table but for every recoed I am getting same image. Please suggest how can I display multiple images coming with respect to various records of data base.
thanks & RegardsHi,
After attempting the solution given above also I am getting the same issue.
On the jspx page I want to show Imageid, imagedescription and photo .
I have 4 records coming from database on the jspx page. I have found that all the data (imageid, description) is first displayed on the jspx and then control gets transferred on the ImageServlet only once and in request.getParameterMap() I get only one "ID" value i.e. the ID value of last record (4th record) coming from data base and hence in all the 4 records on jspx I am getting the same image (i.e. the image in the 4th record of db). Please help me to proceed on this issue.
On jspx, I have given image source value as :
<af:image shortDesc="image"
id="image1"
source="/imageservlet?id=#{bindings.Id.inputValue}}"/>
Thanks -
How to display an image, which is stored in a database?
Hi All,
I would like to display an image with Web Dynpro.
I already know how to display an image which is stored in the path src/mimes/Components/...
But does anybody knows, how to display an image which is stored in a database (e.g. MaxDB)as a datatype of binary?
Thanks in advance!
Regards,
SilviaHallo John,
yes, you can use the Image UI element.
Further you have to create a String for the URL. Implement like as follows:
IWDCachedWebResource cachedResource = null;
String imgUrl = null;
WDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute(IPrivateXYView.IXYElement.PIC_DB);
IWDModifiableBinaryType binaryType =
(IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
binaryType.setMimeType(WDWebResourceType.JPG_IMAGE);//Example *.jpg
WDWebResourceType type = binaryType.getMimeType();
byte[] file = wdContext.currentXYElement().getPicDB();
if (file != null)
cachedResource = WDWebResource.getWebResource(file, type);
try
imgUrl = cachedResource.getURL();
catch (WDURLException e)
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
msgMgr.reportException(e.getLocalizedMessage(), true);
I hope it will help you.
Regards,
Silvia -
How to display a image in webdynpro view using a bytearry
Hi Frndz..
How to display an image in a view using webdynpro java ..i have bytearry object in context ..like
*byte[] img = wdContext.nodeYywwwdataImport_Input().nodeOutput().nodeOutMime().currentOutMimeElement().getLine();*_
by using this i need to show image in view..
Kindly help me ....
Thankas in Advance
Regards
RajeshHi,
byte[] img = wdContext.nodeYywwwdata_Import_Input().nodeOutput().nodeOutMime().currentOutMimeElement().getLine();
use this code to create resource and you need to set this value to the context created to display the image suppose in the image UI and set the source property with this attribute:-
IWDResource res=WDResourceFactory.createCachedResource(b,"MyImage",WDWebResourceType.JPG_IMAGE);
IPrivateAppView.IVn_ImageTabElement imageEle=wdContext.createVn_ImageTabElement();
imageEle .setVa_Name(res.toString());
wdContext.nodeVn_ImageTab().addElement(imageEle);
Hope this may help you.
Deepak -
How to display the image which in KM folder using url iview
Hi Friends
How to display the image, which is under KM folder structur using the url iview.
i trying using url iview url as \document\testfolder\abc.jpg as url for the iview.
but its now working .. so please help me how to slove this problem
If is not the correct way then please suggest me best way to achive this.
Thanks
MukeshHi Mukesh,
I think this may work,
1, Create a HTML Layout.
You can put your image wherever u want with HTML Codes.
Check this, [Article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3915a890-0201-0010-4981-ad7b18146f81] & [Help|http://help.sap.com/saphelp_nw04/helpdata/en/cc/00c93e9b2c3d67e10000000a114084/frameset.htm]
With this, u can use the standard KM commands also.
2, U need to use KM Navigation iView for this rather than KM Doc iView.
3, In the Nav iView, u can use &rndLayoutSet=nameOfUrHTMLLayout to force the view with this new layout.
Regards
BP -
How to test BLOB Table Column in BCBrowser??
Hi,
My requirement is to upload a file(pdf,doc,jpg, txt) into DB using ADF.
I use, Jdev 11.1.1.6, Oracle 10g XE.
For this, I created the following
1. A table as MyFilesTab(ID Number, FileName Varchar2(80), File BLOB)
2. An Entity Object MyFilesEO on MyFilesTab.
3. Generated a default view object: MyFilesVO
4. Application Module : TestAM with view instance "MyFiles"
But When I run TestAM, I see MyFiles as an Input textbox. So I cannot able to add a file that will be stored in my Table.
Please help me out.Just to clarify, my previous post is related to title of this thread("How to test BLOB Table Column in BCBrowser??"),
and not to "My requirement is to upload a file(pdf,doc,jpg, txt) into DB using ADF"
Dario
Maybe you are looking for
-
Fixed Asset procedure For acquirsion Throught Landed Cost
I Have To Import A Fixed Asset From Foreign Vendor.But How Can i Able Charge Landed Cost To That Asset.means Simple Landed Cost procedure just Cost the Charge to Inventory item But How To Fixed Asset Regards Naveed
-
I am not able to generate PO Ack 855 for a cancelled line of a already booked sales order.
PO Ack 855 is getting generated when we are booking a fresh order. But issue arises when we are cancelling any line from the existing sales order, i mean then only system is not generating 855. Thanks, Sunil
-
HP Laserjet 4mp won't print with Snow Leopard
My great Laserjet 4mp prints just fine with OS 10.5.8 but not with Snow Leopard (10.6.2) on my new iMac. Have spent three plus hours with senior level Mac Techs to no avail. The printer screen shows the correct printer and driver and indicating valid
-
"Copy To Oracle" failed if column sequence is different
Hello, I am trying to use the "Copy to Oracle" function to copy data from MSSQL 2008 to Oracle 11g. Since I already go the table created on Oracle and thus, I only need to migrate the data. But I realize that, the copying failed, due to the column se
-
hiiii,right now we are developing dash boards for manufacturing industry,and we are trying to get the actual table names and field names that where exactly these will appear ex.long term assets,cogs invoiced ,in which table it apperas.wht is grr3 an