function populateImageLayer(layer, data, opt) {
  // check if layer is in symbol
  let inSymbol = !!opt.overrides

  // extract image placeholder from layer name
  let imagePlaceholder = Core.placeholders.extractPlaceholders(layer.name())[0]
  if (!imagePlaceholder) return

  // get url by populating the placeholder
  let imageUrl = Core.placeholders.populatePlaceholder(imagePlaceholder, data, '')

  // get image data
  let imageData
  if (imageUrl) {
    imageData = getImageData(imageUrl, opt.rootDir)
    if (!imageData) {
      return Context().document.showMessage(
        'Some images could not be loaded. Please check the URLs.'
      )
    }
  }

  // get layer fill
  let fill = layer.style().fills().firstObject()
  if (!fill) {
    // create new fill
    fill = layer.style().addStylePartOfType(0)
  }

  // set fill properties
  fill.setFillType(4)
  fill.setPatternFillType(1)

  // set image as an override for image layer within a symbol
  if (inSymbol) {
    // get id of image layer
    let layerId = layer.objectID()

    // add override for layer
    if (imageData) {
      opt.overrides.setValue_forKey(imageData, layerId)
    } else {
      opt.overrides.setValue_forKey(getImagePlaceholder(layer), layerId)
    }
  }

  // set image for normal image layer
  else {
    // enable fill
    fill.setIsEnabled(true)

    // set image as fill
    if (imageData) {
      fill.setImage(imageData)
    } else {
      // set default placeholder
      fill.setImage(getImagePlaceholder(layer))
    }
  }
}
Populates an image layer.

@param {MSShapeGroup/MSBitmapLayer} layer
@param {Object} data
@param {Object} opt

opt: {
  rootDir: {String},
  overrides: {NSMutableDictionary}
}