CropImage function

Syntax

CropImage(src_recfield, dst_recfield, [width, height])

Description

Use the CropImage function to crop a source image existing in a database record field and save it to a different destination record field in the database. The source and destination fields must be defined with the same image format: BMP, GIF, or, JPG only.

The image cropping can be constrained to a specific aspect ratio by specifying the optional [width and height parameters. These parameters define the aspect ratio only, and do not constrain the cropping to a specific size. If the aspect ratio is not specified, then the user will be unconstrained when cropping the image.

An error occurs and CropImage returns False when:

  • The source or destination field does not exist in the component buffer.

  • The source or destination field is not of type image

  • The image type of the destination field differs from that of the source field.

  • The destination image field is the same as the source image field.

Note:

CropImage displays the image in actual size. If the image dimensions do not match the device dimensions, it may be difficult to crop the image even though a scroll bar is displayed. In such a case, Oracle PeopleSoft recommends that you resize the image and then crop the image.

Parameters

Parameter Description

src_recfield

Specifies the record field location of the source image file.

dst_recfield

Specifies the record field location of the destination image file.

width

Specifies an aspect ratio width as a numeric value.

height

Specifies an aspect ratio height as a numeric value.

Important: If the width is specified, but the height is omitted, the PeopleCode program will pass syntax checking. However, at run time, the user will encounter an error and will not be able to crop the image.

Returns

A Boolean value: True when successful, False otherwise.

Example

&bRet = CropImage(QE_IMAGE.QE_IMAGE, QE_IMAGE_CROP.QE_CROP_IMAGE, 60, 90);

Restrictions on Use in PeopleCode Events

CropImage is a “think-time” function, which means it shouldn’t be used in any of the following PeopleCode events:

  • SavePreChange

  • SavePostChange

  • Workflow

  • RowSelect

  • Any PeopleCode event that fires as a result of a ScrollSelect (or one of its relatives) function calls, or a Select (or one of its relatives) Rowset class method.

See PeopleCode Developer’s Guide: Think-Time Functions.