Updated on 2024-07-30 GMT+08:00

Uploading a Profile Picture

UploadSelfAvatar

API Description

This API is used to upload a profile picture to the address book on the meeting server.

Precautions

  1. Call this API only when you have logged in.
  2. Upload a JPG or PNG image no more than 200 KB.
  3. The recommended aspect ratio is 1:1.

Method Definition

1
HWM_SDK_AGENT_API hwmsdk::HwmErrCode UploadSelfAvatar(const HwmSelfAvatarInfo *selfAvatarInfo);

Callback Function

1
virtual void OnUploadSelfAvatarResult(hwmsdk::HwmErrCode ret, const char* reason) {};

Parameter Description

Table 1 HwmSelfAvatarInfo parameter

Parameter

Mandatory

Type

Description

path

Yes

char[]

Full path of the image.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
/**
* Upload a profile picture.
*/
int demoUploadSelfAvatarDlg::UploadSelfAvatar()
{
    int ret;
    // Enter the profile picture parameters.
    string path= "to/path/image.png";
    hwmsdkagent::HwmSelfAvatarInfo selfAvatarInfo{};
    strncpy_s(selfAvatarInfo.path, path.c_str(), HWM_MAX_FILE_PATH_LEN);

    // Call the API for uploading a profile picture.
    ret = hwmsdkagent::UploadSelfAvatar(&selfAvatarInfo);
    return ret;
}