Stay organized with collections Save and categorize content based on your preferences.

blockly > FieldImage > (constructor)

FieldImage.(constructor)

Constructs a new instance of the FieldImage class

Signature:

constructor(src: string | Sentinel, width: string | number, height: string | number, opt_alt?: string, opt_onClick?: (p1: FieldImage) => any, opt_flipRtl?: boolean, opt_config?: FieldImageConfig);

Parameters

Parameter Type Description
src string | Sentinel The URL of the image. Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by subclasses that want to handle configuration and setting the field value after their own constructors have run).
width string | number Width of the image.
height string | number Height of the image.
opt_alt string (Optional) Optional alt text for when block is collapsed.
opt_onClick (p1: FieldImage) => any (Optional) Optional function to be called when the image is clicked. If opt_onClick is defined, opt_alt must also be defined.
opt_flipRtl boolean (Optional) Whether to flip the icon in RTL.
opt_config FieldImageConfig (Optional) A map of options used to configure the field. See the [field creation documentation]https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/image#creation for a list of properties this parameter supports.