WordPress\AiClient\Results\DTO

GenerativeAiResult::toImageFile │ public │ WP 0.1.0

Converts the first candidate to an image file.

Метод класса: GenerativeAiResult{}

Хуков нет.

Возвращает

File. The image file.

Использование

$GenerativeAiResult = new GenerativeAiResult();
$GenerativeAiResult->toImageFile(): File;

Список изменений

С версии 0.1.0 Введена.

Код GenerativeAiResult::toImageFile() WP 7.1.3

public function toImageFile(): File
{
    $file = $this->toFile();
    if (!$file->isImage()) {
        throw new RuntimeException(sprintf('File is not an image. MIME type: %s', $file->getMimeType()));
    }
    return $file;
}