 |
|
Oracle Database Tips by Donald Burleson |
Loading
and Displaying Images in APEX
Loading images is very easy in APEX. What you
do with them after they are loaded is another thing. When an
application page is built to upload an image, it will be stored in the WWV_FLOW_FILES view. It is really stored in the wwv_flow_file_objects$
table, but for explanation purposes it will be called wwv_flow_files
since this is how it would be referred in queries.
Even though the uploaded image is initially stored
in WWV_FLOW_FILES, it is not desirable to keep it there. This is
because sometimes it is better to store it in a table in the parsing
schema. That way it is easier to write PL/SQL to access it and makes
it easier to export and import the entire schema, including the
images, when deploying the application.
Once the image is stored in the developer's own
table, which will be called EASY_IMAGE, then a stored procedure can be
created to display the image in an APEX Report.
The following tutorial will:
·
Create the EASY_IMAGE table.
·
Create an application page to load the image.
·
Create a process to move the image to the EASY_IMAGE
table.
·
Create a stored procedure to pull the image from the
EASY_IMAGE table and using some API procedures, display it in an APEX Report.
·
Create an application page with a report region to
display the image.
Create the EASY_IMAGE
Table
In a SQL Command window, run the statements
below. The file named create_easy_image_table.sql in the online code
depot can be used. Another option is to load the file into the SQL
Script repository and run it that way.
create table easy_image (
image_id number not null,
name varchar2(90) not null,
filename varchar2(400),
mime_type varchar2(48),
doc_size number,
created_by varchar2(255),
created_on date,
content_type varchar2(128),
blob_content blob null
)
/
create unique index ak1_easy_image
on easy_image(
image_id )
/
create unique index ak2_easy_image
on easy_image( name
)
/
The above book excerpt is from:
Easy HTML-DB
Oracle Application Express
Create
Dynamic Web Pages with OAE
ISBN 0-9761573-1-4
Michael Cunningham & Kent Crotty
http://www.rampant-books.com/book_2005_2_html_db.htm |