Skip Headers
Oracle® interMedia User's Guide
10g Release 2 (10.2)

Part Number B14302-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 Sample Programs

Oracle interMedia ("interMedia") includes a number of scripts and sample programs that you can use. These consist of SQL, OCI, Java, PL/SQL, and ASP/VBScript sample applications (demos).

Sample interMedia SQL, Java, and OCI applications are available in the following directories after you install interMedia:

On UNIX
<ORACLE_HOME>/ord/img/demo/
<ORACLE_HOME>/ord/http/demo/
<ORACLE_HOME>/ord/im/demo/java/

On Windows
<ORACLE_HOME>\ord\img\demo\
<ORACLE_HOME>\ord\http\demo\
<ORACLE_HOME>\ord\im\demo\java\

A.1 Sample OCI C Program for Modifying Images or Testing Image Installation

Once you have installed interMedia, you may choose to run the interMedia image OCI C program. This program can also be used as a test to confirm successful installation.

This section describes how to run the interMedia image sample program.

The interMedia image sample files are located in <ORACLE_HOME>/ord/img/demo on UNIX and <ORACLE_HOME>\ord\img\demo on Windows where <ORACLE_HOME> is the Oracle home directory.

A.1.1 Sample Program Installation Steps

For interMedia image features, see the README.txt file at <ORACLE_HOME>/ord/img/demo (on UNIX), and <ORACLE_HOME>\ord\img\demo (on Windows), where <ORACLE_HOME> is the Oracle home directory.

A.1.2 Running the Program

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

The program operates on imgdemo.dat, 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 program. In either case, once the image has been manipulated by interMedia, the resulting image is written to the file imgdemo.out and can then be viewed with common rendering tools that you supply.

When the program 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 program 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.

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 program 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.

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

Execute the program by typing imgdemo on the command line.

Use the command shown in Example A-1.

Example A-1 Execute the Sample Program from the Command Line

$ imgdemo <optional-image-filename>

The program 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 program encounters any errors, it is likely that either interMedia software has not been installed correctly, or the database has not been started. If the program 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.

See Section A.2 for a description of the Java sample application that is provided to help you learn to use the multimedia client-side Java classes so you can build your own applications.

A.2 Java Sample Applications

An IMExample Java sample application has been provided to help you learn to use the audio, video, image, and media (ORDDoc) client-side Java classes so you can build your own applications. In this sample application, the sample schema is used to demonstrate the use of the OrdAudio, OrdVideo, OrdImage, and OrdDoc Java objects.

See the README.txt file in the <ORACLE_HOME>/ord/im/demo/java directory on UNIX and <ORACLE_HOME>\ord\im\demo\java directory on Windows for requirements and instructions on how to run this Java sample application. See Chapter 4 for a description of this Java sample application. See Oracle Application Server 10g Multimedia Tag Library for JSP User's Guide and Reference for information about using Oracle Application Server 10g Multimedia Tag Library for JSP. (This manual is available in the Oracle Application Server 10g Online Documentation Library.)

The IMExample Java sample application files are located in:

<ORACLE_HOME>/ord/im/demo/java (on UNIX)

<ORACLE_HOME>\ord\im\demo\java (on Windows)

The interMedia Java Classes Java Servlet Photo Album application shows how to use interMedia Java Classes for Servlets and JSP to upload and retrieve multimedia data. See the README.txt file at:

<ORACLE_HOME>/ord/http/demo/servlet (on UNIX)

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

The interMedia JavaServer Pages Photo Album application shows how to use interMedia Java Classes for Servlets and JSP to upload and retrieve multimedia data. See the README.txt file at:

<ORACLE_HOME>/ord/http/demo/jsp (on UNIX)

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

A.3 Additional PL/SQL Sample Packages

Two additional PL/SQL sample application packages are available after installing interMedia. These packages include:

A.4 Additional ASP/VBScript Sample Application

The interMedia ASP/VBScript Photo Album application illustrates how to upload and retrieve multimedia data with an ASP/VBScript application. See the README.txt file at:

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

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

A.5 Other Sample Programs

See the program examples available from the interMedia Web page on the Oracle Technology Network at

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