code: public function uploadImage($path, $type = 'icon')
      {
          if (!file_exists($path) || !is_readable($path)) {
              throw new InvalidArgumentException("File does not exist, or the file is unreadable: '$path'");
          }
  
          $type = strtolower($type);
  
          return $this->parseJSON('upload', [self::API_MATERIAL_ADD, ['media' => $path], [], ['type' => $type]]);
      }
docs: Upload image material.
  
  @param string $path
  @param string $type
  
  @return string
  
  @throws InvalidArgumentException