1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-12-04 18:57:49 +01:00
MadelineProto/old_docs/API_docs_v72/methods/photos_uploadProfilePhoto.md

69 lines
1.4 KiB
Markdown
Raw Normal View History

2017-11-15 13:41:58 +01:00
---
title: photos.uploadProfilePhoto
2018-03-23 16:23:49 +01:00
description: Upload profile photo
2017-11-15 13:41:58 +01:00
---
## Method: photos.uploadProfilePhoto
[Back to methods index](index.md)
2018-03-23 16:23:49 +01:00
Upload profile photo
2017-11-15 13:41:58 +01:00
### Parameters:
2018-03-23 16:23:49 +01:00
| Name | Type | Required | Description |
|----------|---------------|----------|-------------|
|file|[File path or InputFile](../types/InputFile.md) | Yes|The photo|
2017-11-15 13:41:58 +01:00
### Return type: [photos\_Photo](../types/photos_Photo.md)
### Can bots use this method: **NO**
### Errors this method can return:
| Error | Description |
|----------|---------------|
|FILE_PARTS_INVALID|The number of file parts is invalid|
|IMAGE_PROCESS_FAILED|Failure while processing image|
|PHOTO_CROP_SIZE_SMALL|Photo is too small|
|PHOTO_EXT_INVALID|The extension of the photo is invalid|
2018-03-20 19:57:36 +01:00
### MadelineProto Example:
2017-11-15 13:41:58 +01:00
```
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
2017-11-15 13:41:58 +01:00
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
2017-11-15 13:41:58 +01:00
$photos_Photo = $MadelineProto->photos->uploadProfilePhoto(['file' => InputFile, ]);
```
2018-03-20 19:57:36 +01:00
### [PWRTelegram HTTP API](https://pwrtelegram.xyz) example (NOT FOR MadelineProto):
2017-11-15 13:41:58 +01:00
### As a user:
POST/GET to `https://api.pwrtelegram.xyz/userTOKEN/photos.uploadProfilePhoto`
Parameters:
file - Json encoded InputFile
Or, if you're into Lua:
```
photos_Photo = photos.uploadProfilePhoto({file=InputFile, })
```