Image

Sets the quality or the gray level of an image, or generates a thumbnail of the image with specified options.

eon_mobile_imageex object

Functions
of_createimagewithoptions

Description

Generates an image according to the specified options.

Supported on mobile client only.

Syntax

image.of_createimagewithoptions ( blob ablb_sourcefile, string as_targetfile, eon_mobile_str_imageoption astr_imageoption, ref eon_mobile_str_imageinfo astr_imageinfo )

image.of_createimagewithoptions ( string as_sourcefile, string as_targetfile, eon_mobile_str_imageoption astr_imageoption, ref eon_mobile_str_imageinfo astr_imageinfo )

Argument Type

Argument

Description

eon_mobile_imageex

image

The name of the eon_mobile_imageex object.

blob

ablb_sourcefile

The source file of the image (Blob data).

string

as_sourcefile

The location and file name of the source image.

string

as_targetfile

The location and file name of the generated image. When file name is empty, no image will be generated, only the blob data will be generated, and if b_returnblob of eon_mobile_str_imageoption is false, the function will return an argument error.

eon_mobile_str_imageoption

astr_imageoption

The arguments for generating the target image.

See variable list of eon_mobile_str_imageoption.

eon_mobile_str_imageinfo

astr_imageinfo

The information of the generated image.

See variable list of eon_mobile_str_imageinfo.

Return value

Integer

1 - Successful.

0 - Unknown error.

-1 - Invalid file location.

-2 - Argument error.

-3 - Failed to load the source image file.

-4 - Failed to save the generated image file.

-5 - Failed to compress the image to the specified size.

-6 - Insufficient memory.

-7 - File already exists.

Structures
eon_mobile_str_imageoption

Description

The options for generating the target image.

Property

Type

Variable Name

Description

long

l_width

The width of the target image.

long

l_height

The height of the target image.

integer

i_quality

The quality of the target image: [1, 10]. 10 indicates the original quality. If it is a different number other than 10, it indicates the quality of the target image and only JPG format will be supported and i_imagetype will be ignored.

double

dbl_filesize

When dbl_filesize (same as Blob, unit is BYTE) is greater than zero, i_quality will be ignored, and the image quality will be automatically adjusted according to the value of i_loopstep, and therefore only JPG image type will be supported.
integer

i_loopstep

The percentage of the quality loss during compression: [1-9]. The number indicates the percentage level (1 is 10%, 9 is 90% etc.) that the quality will be reduced by.
boolean

b_aspectfit

Keep the aspect ratio during compression. When it is true, keep the aspect ratio. If the width aspect ratio (the target image width divided by the source image width) is less than the height aspect ratio (the target image height divided by the source image height), then the width aspect ratio will be used as the compression ratio, otherwise, the height aspect ratio will be used as the compression ratio.
boolean

b_returnblob

Whether to return the indicator of the blob data.
boolean

b_grayimage

Whether to gray out the target image.
boolean

b_existoverwrite

Whether to overwrite the existing file.
integer

i_imagetype

The supported image file type: JPG, & PNG
eon_mobile_str_imageinfo

Description

The information of the generated image.

Property

Type

Variable Name

Description

long

l_width

The width of the generated image.

long

l_height

The height of the generated image.

integer

i_quality

The quality of the generated image: [1, 10]. 10 indicates the original quality.

double

dbl_filesize

The size of the generated image.
blob

ablb_filedata

The data of the generated image, only when b_returnblob of eon_mobile_str_imageoption is true, there is value of ablb_filedata.