Image View

This content view is represented by image value for the field type. The image for the image view can be sourced from a local source (as part of the App package) or from a remote source. This is identified by the sourceType field value. The image source is represented by the field source.

Following are the possible values of sourceType field:

  • "remote" -- identifies that the source is a remote url

  • "system" -- identifies that the source is a system icon (SF Symbol for iOS and Material Icon for Android)

  • "dynamic" -- identifies that the source is a local application image path returned by CustomContentDataProvider object.

  • default or absent sourceType field means that source is a local application image path

Following example shows a simplest image content view:

{
      "type": "image",
      "source": "https://picsum.photos/id/1018/300/200.jpg",
      "sourceType": "remote"
}

Image Scaling Mode

Image Content Views support scaling mode with the field scalingMode. The scalingMode field can have the following values:

  • "scaledToFill" -- scales the image to fill its parent, maintaining it's aspect ratio

  • "scaledToFit" -- scales the image to fit its parent, maintaining it's aspect ratio

Scaling Dimensions

Apart from trying to fit or fill the image to its parent view, an image can be rendered to a specific width / height. Appstent CMS supports adding width and/or height fields to the image view content. As image's aspect ratio is always maintained, specifying width suffices in most cases.

Last updated