Download Oracle Multimedia User's Guide

Transcript
Oracle Multimedia Image Metadata Examples
--- store full-size images and thumbnail images as SecureFile LOBs
-LOB(image.source.localdata) STORE AS SECUREFILE
LOB(thumb.source.localdata) STORE AS SECUREFILE
-- and bind the XMLType columns to the interMedia metadata schemas
XMLType COLUMN metaORDImage
XMLSCHEMA "http://xmlns.oracle.com/ord/meta/ordimage"
ELEMENT "ordImageAttributes"
XMLType COLUMN metaEXIF
XMLSCHEMA "http://xmlns.oracle.com/ord/meta/exif"
ELEMENT "exifMetadata"
XMLType COLUMN metaIPTC
XMLSCHEMA "http://xmlns.oracle.com/ord/meta/iptc"
ELEMENT "iptcMetadata"
XMLType COLUMN metaXMP
XMLSCHEMA "http://xmlns.oracle.com/ord/meta/xmp"
ELEMENT "xmpMetadata";
6.6.2 Extracting Image Metadata
The following PL/SQL procedure extracts metadata from an image and stores it in the
specified columns in the photos table you created. This procedure demonstrates the
getMetadata( ) method, which returns an array of XML documents. The root element
of each document is examined to determine the metadata type. The UPDATE
statement stores the documents in the corresponding columns in the photos table.
The code statement where the getMetadata( ) method is called is highlighted in bold.
--- fetch the metadata and sort the results
-PROCEDURE extractMetadata(inID IN INTEGER)
IS
img ORDSYS.ORDIMAGE;
metav XMLSequenceType;
meta_root VARCHAR2(40);
xmlORD XMLType;
xmlXMP XMLType;
xmlEXIF XMLType;
xmlIPTC XMLType;
BEGIN
-- select the image
SELECT image
INTO img
FROM PHOTOS
WHERE id = inID;
-- extract all the metadata
metav := img.getMetadata( 'ALL' );
-- process the result array to discover what types of metadata were
returned
FOR i IN 1..metav.count() LOOP
meta_root := metav(i).getRootElement();
CASE meta_root
WHEN 'ordImageAttributes' THEN xmlORD := metav(i);
WHEN 'xmpMetadata' THEN xmlXMP := metav(i);
6-4 Oracle Multimedia User's Guide