file
A file from the store's media library - what an `image_picker`, `file_picker` or `video` setting returns.
Generated from the platform code - always matches what the theme engine allows.
A file from the store's media library - what an image_picker, file_picker or video setting returns.
Available on: settings that point at it.
Properties
| Property | Type | Description |
|---|---|---|
file.id |
string | File identifier. |
file.mediaType |
string | image, video, document and so on. |
file.vector |
boolean | True for an SVG. SVG files are cleaned on upload (no scripts or external references) and have no renditions. |
file.alt |
string | Alternative text. |
file.name |
string | Original file name. |
file.sizeLabel |
string | Human readable size, for example 1.2 MB. |
file.width |
number or null | Width in pixels for images and videos. |
file.height |
number or null | Height in pixels for images and videos. |
file.url |
string | Address of the original file. |
file.posterUrl |
string or null | Poster frame of a video. |
Methods
| Method | Returns | Description |
|---|---|---|
file.urlForWidth(width) |
string | The rendition closest to a width - used by |image_url(width: …). Prefer the filter. |