Skip Headers
Oracle® Multimedia User's Guide
11g Release 1 (11.1)

Part Number B28415-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

A Oracle Multimedia Sample Applications

Oracle Multimedia includes a number of scripts and sample applications that you can use. These consist of OCI, SQL, Java, PL/SQL, and ASP/VBScript sample applications (demos). These applications are described briefly in the following sections:

The sample applications are available in the following directories after you install Oracle Multimedia:

On Linux and UNIX

<ORACLE_HOME>/ord/img/demo

<ORACLE_HOME>/ord/im/demo/java

<ORACLE_HOME>/ord/http/demo/

On Windows

<ORACLE_HOME>\ord\img\demo

<ORACLE_HOME>\ord\im\demo\java

<ORACLE_HOME>\ord\http\demo\

A.1 Oracle Multimedia Image OCI C Sample Application

Once you have installed Oracle Multimedia, you can run the Oracle Multimedia Image OCI C sample application to modify images. Or, you can use this application as a test to confirm successful installation. The sample application files and README.txt file are located in the Oracle home directory at:

<ORACLE_HOME>/ord/img/demo (on Linux and UNIX)

<ORACLE_HOME>\ord\img\demo (on Windows)

See the README.txt file for more information about Oracle Multimedia image features. This section describes how to run the Oracle MultimediaImage OCI C sample application.

Running the Image OCI C Sample Application

The file imgdemo.c is a sample application that shows how Oracle Multimedia image features can be used from within a program. The application is written in C and uses OCI, Oracle Call Interface, to access the database and use Oracle Multimedia image features.

The application operates on imgdemo.bin, which is a bitmap (BMP) image in the demo directory. Optionally, you can supply an image file name on the command line, provided the file resides in the same directory as the application. In either case, once the image has been manipulated by Oracle Multimedia, the resulting image is written to the file imgdemo.out and can then be viewed with common rendering tools that you supply.

When the application is run, it deletes and re-creates a table named IMGDEMOTAB in the SCOTT schema of the default database. This table is used to hold the application data. Once the table is created, a reference to the image file is inserted into the table. The data is then loaded into the table and converted to JFIF using the processCopy( ) method of ORDImage.

The image properties are extracted within the database using the setProperties( ) method. An UPDATE statement is issued after the setProperties( ) invocation. This is required to make the object attributes permanent because the setProperties( ) invocation has updated only a local copy of the type attributes.

Upon completion, the application leaves the imgdemo.out file in the current directory. It also leaves the table IMGDEMOTAB in the SCOTT schema of the database.

Next, the process( ) method is used to cut and scale the image within the database. This is followed by an update that commits the change. The application cuts a portion of the image 100 pixels wide by 100 pixels high, starting from pixel location (100,100). This subimage is scaled to twice its original size and the resulting image is written out to the file system in a file named imgdemo.out.

Execute the application by typing imgdemo on the command line, as follows:

$ imgdemo <optional-image-filename>

The application displays a number of messages describing its progress, along with any errors encountered in the event that something was not set up correctly. Expect to see the following messages:

Dropping table IMGDEMOTAB... 
Creating and populating table IMGDEMOTAB... 
Loading data into cartridge... 
Modifying image characteristics... 
Writing image to file imgdemo.out... 
Disconnecting from database... 
Logged off and detached from server. 
Demo completed successfully. 

If the application encounters any errors, it is likely that either Oracle Multimedia software has not been installed correctly, or the database has not been started. If the application completes successfully, the original image and the resulting image, which has undergone the cutting and scaling described earlier, can be viewed with common image rendering tools.

A.2 Oracle Multimedia Java Sample Applications

Three Java sample applications are available after installing Oracle Multimedia. These include:

A.3 Oracle Multimedia PL/SQL Sample Applications

Two PL/SQL sample applications are available after installing Oracle Multimedia. These include:

A.4 Oracle Multimedia ASP/VBScript Sample Application

Oracle Multimedia also provides the Oracle Multimedia ASP/VBScript Photo Album sample application, which shows how to upload and retrieve multimedia data using Microsoft Active Server Pages (ASP) and Visual Basic Scripting (VBScript). The sample application files and README.txt file are located at:

<ORACLE_HOME>/ord/http/demo/asp (on Linux and UNIX)

<ORACLE_HOME>\ord\http\demo\asp (on Windows)

See the README.txt file for requirements and instructions on how to run this sample application. See Section 3.4 for more information about installing and using this application.

A.5 Other Oracle Multimedia Sample Applications

Additional Oracle Multimedia sample applications are available from the Oracle Multimedia Web page on the Oracle Technology Network at

http://www.oracle.com/technology/sample_code/products/intermedia/