Google\Cloud\Vision\Image::imageObject PHP Method

imageObject() private method

The structure of the returned array will vary depending on whether the given image is a storage object or not.
See also: https://cloud.google.com/vision/reference/rest/v1/images/annotate#image Image
private imageObject ( boolean $encode ) : array
$encode boolean If set to true, image bytes will be base64-encoded
return array [Image](https://cloud.google.com/vision/reference/rest/v1/images/annotate#image)
    private function imageObject($encode)
    {
        if ($this->type === self::TYPE_BYTES) {
            $bytes = (string) $this->image;
            return ['content' => $encode ? base64_encode($bytes) : $bytes];
        }
        if ($this->type === self::TYPE_STRING) {
            $string = $this->image;
            return ['content' => $encode ? base64_encode($string) : $string];
        }
        return ['source' => ['gcsImageUri' => $this->image]];
    }