examples/AdWords/v201809/ShoppingCampaigns/AddShoppingCampaignForShowcaseAds.php
private static function uploadImage(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $url
    ) {
        $mediaService = $adWordsServices->get($session, MediaService::class);

        // Create image.
        $image = new Image();
        $image->setData(file_get_contents($url));
        $image->setType(MediaMediaType::IMAGE);

        // Upload image into the server.
        $result = $mediaService->upload([$image]);

        return $result[0]->getMediaId();
    }
private static function uploadImage(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $url
    ) {
        $mediaService = $adWordsServices->get($session, MediaService::class);

        // Create image.
        $image = new Image();
        $image->setData(file_get_contents($url));
        $image->setType(MediaMediaType::IMAGE);

        // Upload image into the server.
        $result = $mediaService->upload([$image]);

        return $result[0]->getMediaId();
    }
private static function uploadImage ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ url ) { $ mediaService = $ adWordsServices -> get ( $ session , MediaService :: class ) ; // Create image. $ image = new Image ( ) ; $ image -> setData ( file_get_contents ( $ url ) ) ; $ image -> setType ( MediaMediaType :: IMAGE ) ; // Upload image into the server. $ result = $ mediaService -> upload ( [ $ image ] ) ; return $ result [ 0 ] -> getMediaId ( ) ; }
Uploads an image.
Uploads an image .