Vision/src/Image.php
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' => [
                'imageUri' => $this->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' => [
                'imageUri' => $this->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' => [ 'imageUri' => $ this -> image ] ] ; }
Create an image object.

The structure of the returned array will vary depending on whether the
given image is a storage object or not.

@see https://cloud.google.com/vision/reference/rest/v1/images/annotate#image Image

@param  bool $encode If set to true, image bytes will be base64-encoded
@return array [Image](https://cloud.google.com/vision/reference/rest/v1/images/annotate#image)
Create an image object .