You can display an externally hosted image in MDriven Turnkey by marking a string ViewModel column with the DataIsImageUrl tagged value; use this when the column contains an image URL rather than image data stored in a Blob field.
How it works
When DataIsImageUrl is set on a ViewModelColumn, Turnkey treats the column's string value as the URL of an image to render.
The column must provide a valid URL that the user's browser can reach. The image is not stored in the database through this setting; the URL points to where the image is available.
For example, a ViewModel column named ProductImageUrl can contain:
https://example.com/images/product-42.png
With DataIsImageUrl set on ProductImageUrl, Turnkey renders the referenced image instead of presenting the URL as ordinary text.
Configure a ViewModel column
- In MDriven Designer, add or select the ViewModelColumn that supplies the image URL.
- Ensure that the column value is a string containing the image URL.
- Set the DataIsImageUrl TaggedValue on that ViewModelColumn.
- Run the ViewModel in Turnkey and confirm that the URL resolves to the intended image.
When to use it
Use DataIsImageUrl when the image is hosted outside the data represented by your ViewModel, such as an image served from a web location.
| Requirement | Use |
|---|---|
| The column contains a URL to an image | Set DataIsImageUrl on the ViewModelColumn. |
| The column contains a URL that users should click as a normal hyperlink | Use DataIsLink instead. |
| The column contains HTML that should be rendered as HTML | Use DataIsHtml instead. |
| The image is stored as Blob data | Do not use DataIsImageUrl; this setting is intended for a string URL rather than a Blob image field. |
Example
Assume a product ViewModel has these values:
| Column | Value | TaggedValue |
|---|---|---|
Name
|
Trail Backpack
|
|
ProductImageUrl
|
https://example.com/images/trail-backpack.jpg
|
DataIsImageUrl
|
Turnkey uses the value in ProductImageUrl as the image source. If the URL is unavailable or does not refer to an image the browser can render, the image cannot be displayed.
