When you update an object, you need to identify its format. The extenders will store the updating image, audio, or video object in the same format as the source. For image objects only, you have the option of having the Image Extender convert the format of the updated image. If you want to have the image format converted, you need to specify the format of the update source and the format of the target image. The target image is the updated image as stored.
Specify the format of the source image, audio, or video object when you update an object without format conversion. For example, the following statement in a C application program updates a bitmap (BMP) image whose content is in a server file. The format of the updated image will not be converted.
EXEC SQL UPDATE EMPLOYEE SET PICTURE=CONTENT( PICTURE, '/employee/newimg/ajones.bmp', 'BMP', /*image format*/ '') WHERE NAME='Anita Jones';
You can also specify a null value or empty string as the format, or for the Image Extender only, the character string ASIS. The extender will then determine the format by examining the source.
Use NULL or ASIS for recognizable formats: Specify a null value, empty string, or ASIS only if the format is recognizable to the extender, that is, if it is one of the formats listed for the extender in Table 4. Otherwise, the extender cannot update the object.
Specify the format of both the source and target images when you update an image with format conversion. Table 4 lists which format conversions are allowed.
In addition, you can specify conversion options that identify additional changes, such as rotation or compression, that you want to apply to the updated image. You specify each conversion option through a parameter and an associated value. The parameters and allowed values are listed in Table 5. You can request multiple changes to the updated image by specifying multiple parameter/value pairs.
In the following example, an image whose content is in a server file is updated. The source of the update is in bitmap (BMP) format. The format will be converted from BMP to GIF on update.
EXEC SQL UPDATE EMPLOYEE SET PICTURE=CONTENT( PICTURE, '/employee/newimg/ajones.bmp', 'BMP', /*source format*/ 'GIF', /*target format*/ '') WHERE NAME='Anita Jones';
In the following example, the same image is converted to GIF format when updated. In addition, the image is rotated 90 degrees clockwise when updated.
EXEC SQL UPDATE EMPLOYEE SET PICTURE=CONTENT( PICTURE, '/employee/newimg/ajones.bmp', 'BMP', /*source format*/ 'GIF', /*target format*/ '-r 1', /* conversion options */ '') WHERE NAME='Anita Jones';