examples/AdWords/v201809/AdvancedOperations/AddGmailAd.php
private static function uploadImage(MediaService $mediaService, $url)
    {
        // Creates an image and upload it to the server.
        $image = new Image();
        $image->setData(file_get_contents($url));
        $image->setType(MediaMediaType::IMAGE);

        return $mediaService->upload([$image])[0];
    }
private static function uploadImage(MediaService $mediaService, $url)
    {
        // Creates an image and upload it to the server.
        $image = new Image();
        $image->setData(file_get_contents($url));
        $image->setType(MediaMediaType::IMAGE);

        return $mediaService->upload([$image])[0];
    }
private static function uploadImage ( MediaService $ mediaService , $ url ) { // Creates an image and upload it to the server. $ image = new Image ( ) ; $ image -> setData ( file_get_contents ( $ url ) ) ; $ image -> setType ( MediaMediaType :: IMAGE ) ; return $ mediaService -> upload ( [ $ image ] ) [ 0 ] ; }
Uploads an image to the server.

@param MediaService $mediaService the media service
@param string $url the URL of image to upload
@return Image the uploaded image returned from the server
Uploads an image to the server .