*/
function UploadImageExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $mediaService = $user->GetService('MediaService', ADWORDS_VERSION);
    // Create image.
    $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);
    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);
}
// Don't run the example if the file is being included.
if (__FILE__ != realpath($_SERVER['PHP_SELF'])) {
    return;
}
try {
    // Get AdWordsUser from credentials in "../auth.ini"
    // relative to the AdWordsUser.php file's directory.
    $user = new AdWordsUser();
    // Log every SOAP XML request and response.
    $user->LogAll();
    // Run the example.
    UploadImageExample($user);
} catch (Exception $e) {
    printf("An error has occurred: %s\n", $e->getMessage());
}
 public function testUploadImageExample()
 {
     UploadImageExample($this->user);
 }