Image

Image

Class that reactively updates the image of an img element whenever the state of its owner changes.

Constructor

new Image(owner, element, options)

Source:
Parameters:
Name Type Description
owner Ripe The Ripe instance to be shown.
element Object The img element that should be updated.
options Object An object with options to configure the image, such as: - 'showInitials' - A Boolean indicating if the owner's personalization should be shown (defaults to 'true¨). - 'initialsBuilder' - A function that receives the initials and engraving as Strings and the img element that will be used and returns a map with the initials and a profile list. - 'frame' - The Ripe instance frame to display (defaults to '0'). - 'size' - The image size in pixels (defaults to '1000'). - 'width' - The image width in pixels (defaults to 'null', meaning it will fallback to 'size'). - 'height' - The image height in pixels (defaults to 'null', meaning it will fallback to 'size'). - 'crop' - A Boolean indicating if it is to crop the image composition.

Methods

cancel(options)

This function is called (by the owner) whenever the current operation in the child should be canceled this way an Image is not updated.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the Image.

deinit()

The Image deinitializer, to be called (by the owner) when it should stop responding to updates so that any necessary cleanup operations can be executed.
Source:

init()

The Image initializer, which is called (by the owner) whenever the Image is going to become active. Sets the various values for the Image taking into owner's default values.
Source:

resize(size)

Resizes the Image's DOM element to 'size' pixels, both the width and the height of the image will reflect this value.
Source:
Parameters:
Name Type Description
size String The number of pixels to resize to.

setFrame(frame, options)

Updates the frame that the Image is referring to.
Source:
Parameters:
Name Type Description
frame String The Ripe instance frame to display.
options Object An object with options to configure the setting of the frame.

setInitialsBuilder(builder, options)

Updates the Image's 'initialsBuilder' function.
Source:
Parameters:
Name Type Description
builder function The new 'initialsBuilder' function to be used by the Image.
options Object An object with options to configure the setting of the 'initialsBuilder'.

setShowInitials(showInitials)

Updates the Image's 'showInitials' flag that indicates if the initials should be display in the image.
Source:
Parameters:
Name Type Description
showInitials String If the image should display initials.

update(state, options)

This function is called (by the owner) whenever its state changes so that the Image can update itself for the new state.
Source:
Parameters:
Name Type Description
state Object An object containing the new state of the owner.
options Object Set of optional parameters to adjust the Image.

updateOptions(options, update)

Updates the Image's current options with the ones provided.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the Image, such as: - 'format' - The format of the image, (eg: png, jpg, svg, etc.). - 'crop' - A Boolean indicating if the resulting image should be cropped. - 'initialsGroup' - The group in which the image initials belongs to.
update Boolean If an update operation should be executed after the options updated operation has been performed.