IBM Books

Image, Audio, and Video Extenders Administration and Programming

Storing a thumbnail (image and video only)

When you store an image of your own format, you can also store a thumbnail, a miniature-sized version of the image. You control the size and format of the thumbnail. When you store an image in a format that the Image Extender recognizes, it automatically generates and stores a thumbnail for the object. The Image Extender creates a thumbnail in GIF format of size 112 x 84 pixels.

When you store a video object of your own format, you can also store a thumbnail that symbolizes the video object. When you store a video object in a format that the Video Extender recognizes, it automatically stores a generic thumbnail for the object. The Video Extender creates a thumbnail in GIF format of size 108 x 78 pixels.

If you don't want to store a thumbnail when you store an image or video object with user-supplied attributes, specify a null value or empty string in place of the thumbnail.

Generate the thumbnail in your program--the extenders do not provide APIs to generate thumbnails. Create a structure in your program for the thumbnail and specify the thumbnail structure in the UDF.

The following statements in a C application program store a row that includes a video clip in a database table. The source video clip, whose content is in a server file, has a user-defined format. The video content will remain in the server and be pointed to from the table. A thumbnail of a representative video frame is also stored.

EXEC SQL BEGIN DECLARE SECTION;
  long hvStorageType;
struct {
       short len;
       char data[4000];
       }hvVidattrs;
struct {
       short len;
       char data[10000];
       }hvThumbnail;
EXEC SQL END DECLARE SECTION;
 
MMDBVideoAttrs         *pvideoAttr;
 
hvStorageType=MMDB_STORAGE_TYPE_EXTERNAL;
 
pvideoAttr=(MMDBVideoAttrs *) hvVidattrs.data;
strcpy(pvideoAttr>cFormat,"Formatv");
hvVidattrs.len=sizeof(MMDBVideoAttrs);
 
/* Generate thumbnail and assign data in video structure */
 
EXEC SQL INSERT INTO EMPLOYEE VALUES(
        '128557',
        'Anita Jones',
        DB2VIDEO(
          CURRENT SERVER,
          '/employee/videos/ajones.vid',
          :hvStorageType,
          'Anita''s video',
          :hvVidattrs,
          :hvThumbnail)                     /* Thumbnail*/
       );


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]