Hi, 

This thread seems to be outdated. 
Can you please start the new thread?

Please separate your code into two parts, uploading an image and making a 
image ad. 
Please narrow down the issue by following the image uploading 
example<https://code.google.com/p/google-api-adwords-php/source/browse/examples/AdWords/v201309/Misc/UploadImage.php>first

Best,
- Takeshi, AdWords API Team

On Friday, November 8, 2013 9:33:00 PM UTC+9, [email protected] wrote:
>
> Hi,
>
> I am struggling with this error... Please help out ..  I have created 
> below custom function to push image ads ... but getting error : 
>  <faultstring>[NullError.NULL_CONTENT @ 
> operations[0].operand.ad.image.data]</faultstring>
>
>
> function AddImageAdsExample(AdWordsUser $user, $adGroupId) {
>
>   $mediaService = $user->GetService('MediaService', ADWORDS_VERSION);
>   $adGroupAdService = $user->GetService('AdGroupAdService', 
> ADWORDS_VERSION);
>
>   $numAds = 1;
>   $operations = array();
>   for ($i = 0; $i < $numAds; $i++) {
>   $image = new Image();
>   $image->data = MediaUtils::GetBase64Data('http://goo.gl/HJM3L');
>   $image->type = 'IMAGE';
>
>   
>   // Make the upload request.
>   $result = $mediaService->upload(array($image));
>
>   // Display result.
>   $image = $result[0];
>   $dimensions = MapUtils::GetMap($image->dimensions);
>
>   $ImageAd = new ImageAd();
>   $ImageAd->displayUrl = "http://www.google.com";;
>   $ImageAd->url = "http://www.yahoo.com";;
>   //$ImageAd->devicePreference = "On";
>   $ImageAd->name = "testimage";
>   $ImageAd->image = $image ; 
>
>     // Create ad group ad.
>     $adGroupAd = new AdGroupAd();
>     $adGroupAd->adGroupId = $adGroupId;
>     $adGroupAd->ad = $ImageAd;
>
>     // Set additional settings (optional).
>     $adGroupAd->status = 'PAUSED';
>
>     // Create operation.
>     $operation = new AdGroupAdOperation();
>     $operation->operand = $adGroupAd;
>     $operation->operator = 'ADD';
>     $operations[] = $operation;
> printf("Image with dimensions '%dx%d', MIME type '%s', and id '%s' was "
>       . "uploaded.\n", $dimensions['FULL']->width,
>       $dimensions['FULL']->height, $image->mimeType, $image->mediaId);
>
>   }
>
>   // Make the mutate request.
>   $result = $adGroupAdService->mutate($operations);
> foreach ($result->value as $adGroupAd) {
>     printf("Banner ad with text '%s' and ID '%s' was added.\n",
>         $adGroupAd->ad->name, $adGroupAd->ad->id);
>   }
> }
>
> Please help me out .. what I am missing in it !!! 
>
> On Tuesday, May 1, 2012 11:57:23 PM UTC+5:30, Kevin Winter wrote:
>>
>> Hi,
>>   Sorry about that, I was mistaken.  The MediaService will only return 
>> back entries for items uploaded via itself, which can be used in 
>> TemplateAds.
>>
>> When an image gets uploaded via a AdGroupAd operation, it is not visible 
>> via the MediaService.
>>
>> The converse is that you must upload an image via the AdGroupAdService 
>> (you must provide Name, Dimensions and ImageData).  You can use 
>> the adToCopyImageFrom field to copy an image from an existing field - but 
>> you cannot specify a mediaId as I incorrectly stated previously.  I 
>> apologize for the confusion.
>>
>> - Kevin Winter, AdWords API Team
>>
>> On Tuesday, May 1, 2012 7:04:38 AM UTC-4, [email protected] wrote:
>>>
>>> Hi Kevin,
>>>
>>> I tried to do it according to that way, however:
>>>
>>> i got an error: NullError.NULL_CONTENT @ 
>>> operations[0].operand.ad.image.data
>>>
>>> this error got when trying to add the AdGroupAd
>>>
>>> p.s - im using the sandbox with the java client
>>>
>>>
>>>
>>> On Monday, April 30, 2012 10:41:32 PM UTC+3, Kevin Winter wrote:
>>>>
>>>> Hi,
>>>>   Yes, this is the correct way to do it.
>>>>
>>>> - Kevin Winter
>>>> AdWords API Team
>>>>
>>>> On Monday, April 30, 2012 11:03:21 AM UTC-4, [email protected] wrote:
>>>>>
>>>>> ok, so to make sure i underestand
>>>>>
>>>>> upload an image using the media service - got an media id of this 
>>>>> image.
>>>>>
>>>>> then when creating a new adGroupAd, set the adGroupAd -> imageAd -> 
>>>>> image -> mediaId with the received media id of the uploaded image
>>>>>
>>>>> got it ?
>>>>>
>>>>> 10x again :)
>>>>>
>>>>>
>>>>>
>>>>> On Monday, April 30, 2012 5:53:36 PM UTC+3, Kevin Winter wrote:
>>>>>>
>>>>>> Hi,
>>>>>>   When you send the ImageAd object to the AdWords API, you can 
>>>>>> populate the image field (
>>>>>> https://developers.google.com/adwords/api/docs/reference/latest/AdGroupAdService.Image)
>>>>>>  
>>>>>> and just specify the mediaId as returned by the MediaService.  Most 
>>>>>> of the rest of the fields are readonly, and the name and imageData 
>>>>>> fields 
>>>>>> should only be sent to the MediaService, not with AdGroupAdService 
>>>>>> requests.
>>>>>>
>>>>>> - Kevin Winter
>>>>>> AdWords API Team
>>>>>>
>>>>>> On Monday, April 30, 2012 10:34:49 AM UTC-4, [email protected] wrote:
>>>>>>>
>>>>>>> Hi Kevin,
>>>>>>>
>>>>>>> thank you very much for your replay
>>>>>>> i know aobut the adToCopyImageFrom field.
>>>>>>> i wanted to know about the media service, once i upload an image 
>>>>>>> with the media service, how then can i use this imgae ?
>>>>>>>
>>>>>>> 10x !
>>>>>>> udy
>>>>>>> On Monday, April 30, 2012 5:08:06 PM UTC+3, Kevin Winter wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>   Actually, the AdGroupAdService makes this easier if another Ad 
>>>>>>>> already has the image you wish. You can use the adToCopyImageFrom 
>>>>>>>> field of 
>>>>>>>> the ImageAd object to tell it to reuse the Image of an existing ad: 
>>>>>>>> https://developers.google.com/adwords/api/docs/reference/latest/AdGroupAdService.ImageAd#adToCopyImageFrom
>>>>>>>>
>>>>>>>> If the image does not already exist, you will have to upload it at 
>>>>>>>> least once with the MediaService.
>>>>>>>>
>>>>>>>> - Kevin Winter, AdWords API Team
>>>>>>>>
>>>>>>>> On Sunday, April 22, 2012 2:44:01 AM UTC-4, [email protected] wrote:
>>>>>>>>>
>>>>>>>>> hi,
>>>>>>>>>
>>>>>>>>> is the media service can be used in such way that when creating an 
>>>>>>>>> image ad we wont need to tupload an image every time ?
>>>>>>>>>
>>>>>>>>> thanx  in advnace!
>>>>>>>>>
>>>>>>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to