Image

The Image class can be used to create an Image, which can be used in the Flow Editor. An image must be registered, and the contents will be retrieved when needed.

Table of Contents

Constructor

new Homey.Image(format)

Parameters:
Name Type Description
format String

Allowed image formats are png, jpg and gif.

Methods

getBuffer(callback) → {Promise}

Get the Buffer

Parameters:
Name Type Description
callback function
Name Type Description
err Error
data Buffer
Returns:
Type:
Promise

getFormat() → {String}

Get the format

Returns:
Type:
String

format Either png, jpg or gif

register(callbackopt) → {Promise}

Register the image. This is a shorthand method for ManagerImages#registerImage.

Parameters:
Name Type Attributes Description
callback function <optional>
Name Type Description
err Error
image Image
Returns:
Type:
Promise

setBuffer(source)

Set the image's data

Parameters:
Name Type Description
source Buffer | function

A buffer of the image, or a Function. When provided a function, this will be called with parameters (args, callback) when someone requests the buffer. This is mostly useful for external image sources.

setPath(path)

Set the image's path

Parameters:
Name Type Description
path String

Relative path to your image, e.g. /userdata/kitten.jpg

setUrl(url)

Set the image's URL. This URL must be accessible from any network.

Parameters:
Name Type Description
url String

Absolute url, https://

unregister(callbackopt) → {Promise}

Unregister the image. This is a shorthand method for ManagerImages#unregisterImage.

Parameters:
Name Type Attributes Description
callback genericCallbackFunction <optional>
Returns:
Type:
Promise

update(callback) → {Promise}

Notify that the image's contents have changed

Parameters:
Name Type Description
callback
Name Type Description
err Error
Returns:
Type:
Promise