You are here

function zoomapi_user_uploadpicture in Zoom API 7

Upload picture to Zoom account.

Note: The Zoom API docs mention the image file must be jpg/jpeg.

@todo add watchdog. @todo figure out 'multipart/form-data' error.

Parameters

object $account: The Drupal user account to check if matching Zoom API account exists.

object $image_file: The Drupal file object.

File

./zoomapi.module, line 345
Main file for the Zoom API module.

Code

function zoomapi_user_uploadpicture($account, $image_file = NULL) {
  if (TRUE) {

    // Figure out @todo error.
    return;
  }
  if (empty($account->data['zoomapi_user_id'])) {
    return;
  }
  if (!$image_file) {
    if (empty($account->picture)) {
      return;
    }
    $image_file = $account->picture;
  }
  if ($image_file->filemime != 'image/jpeg') {
    return;
  }
  $image_url = file_create_url($image_file->uri);
  $zoomapi_user = new ZoomAPIUser();
  $zoomapi_user
    ->uploadpicture($account->data['zoomapi_user_id'], $image_url);
}