WordPress\AiClient\Files\DTO

File::getDataUripublicWP 0.1.0

Gets the data as a data URI for inline files.

Method of the class: File{}

No Hooks.

Returns

String|null. The data URI in format: data:[mimeType];base64,[data], or null if not an inline file.

Usage

$File = new File();
$File->getDataUri(): ?string;

Changelog

Since 0.1.0 Introduced.

File::getDataUri() code WP 7.0

public function getDataUri(): ?string
{
    if ($this->base64Data === null) {
        return null;
    }
    return sprintf('data:%s;base64,%s', $this->getMimeType(), $this->base64Data);
}