FilePath

data class FilePath(val path: String, val mimeType: MimeType = MimeType.tryDetect(path)) : ImageSource

An image referenced by local file path.

Samples

// Create an image from FilePath.
val imageSource =
    ImageSource.FilePath(path = "path/to/photo.png", mimeType = MimeType.Image.Png) // By default, the MIME type is detected based on the file extension.
        .takeIf { it.exists() }

imageSource.let { image ->
    // Add image Source to content and send to API...
}

Constructors

Link copied to clipboard
constructor(path: String, mimeType: MimeType = MimeType.tryDetect(path))

Properties

Link copied to clipboard

The MIME type (default: "image/jpeg").

Link copied to clipboard

The file system path to the image.

Functions

Link copied to clipboard
Link copied to clipboard
fun onNotFound(action: () -> Unit): ImageSource.FilePath?
Link copied to clipboard

Serializes this ImageSource to a string representation.