Use the Thumbnail UDF to update a thumbnail stored for an image or video object (or add a thumbnail if none is associated with the stored image or video). When you use the Thumbnail UDF, specify the handle of the object whose thumbnail is being updated, and specify the content of the updated (or new) thumbnail.
Generate the thumbnail in your program--the extenders do not provide APIs to generate thumbnails. You control the size and format of the updating thumbnail. Create a structure in your program for the thumbnail, and specify the thumbnail structure in the UDF.
For example, the following statements in a C application program update the thumbnail associated with a stored video clip.
EXEC SQL BEGIN DECLARE SECTION; struct { short len; char data[10000]; }hvThumbnail; EXEC SQL END DECLARE SECTION; /*Create thumbnail and store in hvThumbnail*/ EXEC SQL UPDATE employee SET picture=Thumbnail( picture, :hvThumbnail) WHERE name='Anita Jones';
You can also update a thumbnail when you update an image or video object with user-supplied attributes. In fact, if you update an image or video with user-supplied attributes, you must specify a thumbnail as input. If you do not want to update the thumbnail when you update the object, specify a null value or empty string in place of the thumbnail specification.
The following statements in a C application program update a video clip with user-supplied attributes, and update a thumbnail associated with the video.
EXEC SQL BEGIN DECLARE SECTION; long hvStorageType; struct { short len; char data[400]; }hvVidattrs; struct { short len; char data[10000]; }hvThumbnail; EXEC SQL END DECLARE SECTION; hvStorageType=MMDB_STORAGE_TYPE_EXTERNAL; MMDBVideoAttrs *pvideoAttr; pvideoAttr=(MMDBVideoAttrs *)hvVidattrs.data; strcpy(pvideoAttr>cformat,"Formatv"); hvVidattrs.len=sizeof(MMDBVideoAttrs); /* Update video content and thumbnail */ EXEC SQL UPDATE EMPLOYEE SET VIDEO=REPLACE( VIDEO, '/employee/newvid/ajones.mpg', :hvStorageType, 'Anita''s new video', :VidAttrs, :hvThumbnail) /*thumbnail*/ WHERE NAME='Anita Jones';