# new RezAsset()
Represents a media asset in the Rez game engine. Assets can be images, audio, video, or text files. Provides methods for determining asset type and generating HTML elements for display. Asset MIME types are detected during compilation and stored in the $detected_mime_type attribute.
Extends
Methods
# static assetType() → {string}
Returns the primary MIME type category for this asset
if no MIME type information is available
Error
the primary asset type (e.g., "image", "audio", "video", "text")
string
# static audioTag()
Placeholder for generating HTML audio tags (not yet implemented)
audio tags are not yet implemented
Error
# static constructor(id, attributes)
Creates a new asset instance
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string
|
unique identifier for this asset |
attributes |
object
|
asset attributes from Rez compilation including file path and MIME type |
# static getHeight(h) → {number}
Gets the height for this asset, using the provided override if available, falling back to the asset's height attribute.
Parameters:
| Name | Type | Description |
|---|---|---|
h |
number
|
optional height override |
if no height is specified and no default is provided
Error
the height to use for this asset
number
# static getWidth(w) → {number}
Gets the width for this asset, using the provided override if available, falling back to the asset's width attribute.
Parameters:
| Name | Type | Description |
|---|---|---|
w |
number
|
optional width override |
if no width is specified and no default is provided
Error
the width to use for this asset
number
# static imageElement(w, h) → {HTMLImageElement}
Creates an HTML image element for this asset with the specified or default dimensions
Parameters:
| Name | Type | Description |
|---|---|---|
w |
number
|
optional width override |
h |
number
|
optional height override |
an HTML image element configured for this asset
HTMLImageElement
# static imageTag(w, h) → {string}
Generates an HTML image tag string for this asset with specified or default dimensions
Parameters:
| Name | Type | Description |
|---|---|---|
w |
number
|
optional width override |
h |
number
|
optional height override |
HTML image tag as a string
string
# static isAudio() → {boolean}
Determines if this asset is an audio file
true if this asset is an audio file
boolean
# static isImage() → {boolean}
Determines if this asset is an image file
true if this asset is an image
boolean
# static isText() → {boolean}
Determines if this asset is a text file
true if this asset is a text file
boolean
# static isVideo() → {boolean}
Determines if this asset is a video file
true if this asset is a video file
boolean
# static videoTag()
Placeholder for generating HTML video tags (not yet implemented)
video tags are not yet implemented
Error