Resource

Displays a resource dropwell that accepts all file types.

{
  "title": "Image",
  "id": "image",
  "resource": {}
}

Using Resources in Templates

Resource Properties

When you define a resource control, you can access its properties in your template:

Property
Description

{{resource.image}}

The URL/path to the image

{{resource.path}}

The file path (use for non-image files like video, PDF)

{{resource.width}}

Original width in pixels (images only)

{{resource.height}}

Original height in pixels (images only)

{{resource.aspect}}

Aspect ratio, e.g. 16/9 (images only)

Displaying an Image

<img
  src="{{photo.image}}"
  alt="{{altText}}"
  width="{{photo.width}}"
  height="{{photo.height}}"
/>

Displaying a Video

For non-image resources like video files, use the .path property:

Checking if a Resource Exists

Use a conditional to handle cases where no resource has been selected:

Resource Dropzones

You can enable drag-and-drop directly onto an element in the editor by adding the rwResourceDropZone attribute. The value should match the id of your resource control.

Complete Example

properties.json:

templates/index.html:

Last updated

Was this helpful?