class Asciidoctor::AbstractNode

def image_uri(target_image, asset_dir_key = 'imagesdir')

Returns A String reference or data URI for the target image

the image is located (default: 'imagesdir')
asset_dir_key - The String attribute key used to lookup the directory where
target_image - A String path to the target image

The return value of this method can be safely used in an image tag.

are satisfied, a relative path (i.e., URL) will be returned.
by reading it from the same directory. If neither of these conditions
is less than SafeMode::SECURE, the image will be safely converted to a data URI
If the 'data-uri' attribute is set on the document, and the safe mode level

specified attribute key, if provided.
The target image is resolved relative to the directory retrieved from the

If the target image is a URI reference, then leave it untouched.

Public: Construct a URI reference or data URI to the target image.
def image_uri(target_image, asset_dir_key = 'imagesdir')
  if (doc = @document).safe < SafeMode::SECURE && (doc.attr? 'data-uri')
    if ((Helpers.uriish? target_image) && (target_image = Helpers.encode_spaces_in_uri target_image)) ||
        (asset_dir_key && (images_base = doc.attr asset_dir_key) && (Helpers.uriish? images_base) &&
        (target_image = normalize_web_path target_image, images_base, false))
      (doc.attr? 'allow-uri-read') ? (generate_data_uri_from_uri target_image, (doc.attr? 'cache-uri')) : target_image
    else
      generate_data_uri target_image, asset_dir_key
    end
  else
    normalize_web_path target_image, (asset_dir_key ? (doc.attr asset_dir_key) : nil)
  end
end