1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-01-24 05:36:29 +02:00
OpenIntegrations/docs/en/md/VK/Community-managment/Save-image-to-album.mdx
Vitaly the Alpaca (bot) 20c8a991c5 Main build (Jenkins)
2024-10-15 13:51:58 +03:00

136 lines
5.4 KiB
Plaintext

---
sidebar_position: 8
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Save image to album
Saves an image to the community album
`Function SaveImageToAlbum(Val AlbumID, Val Image, Val Description = "", Val Parameters = "") Export`
| Parameter | CLI option | Type | Description |
|-|-|-|-|
| AlbumID | --album | String, Number | Album ID |
| Image | --picture | BinaryData,String | Image file |
| Description | --description | String | Image description |
| Parameters | --auth | Structure Of String | Authorization JSON or path to .json |
Returns: Map Of KeyAndValue - serialized JSON response from VK
<br/>
:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
```bsl title="Code example"
Parameters = GetVKParameters();
ImageDescription = "AutoTestImage";
AlbumID = "305187504";
Image = "https://openintegrations.dev/test_data/picture.jpg"; // URL, Path to file or Binary Data
TFN = GetTempFileName("png");
FileCopy(Image, TFN);
Image = New BinaryData(TFN);
Result = OPI_VK.SaveImageToAlbum(AlbumID, Image, ImageDescription, Parameters);
Result = OPI_VK.SaveImageToAlbum(AlbumID, TFN, ImageDescription, Parameters);
```
```json title="Result"
{
"response": [
{
"album_id": 306043366,
"date": 1728453694,
"id": 457249074,
"owner_id": -218861756,
"sizes": [
{
"height": 56,
"type": "s",
"width": 75,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=75x56"
},
{
"height": 97,
"type": "m",
"width": 130,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=130x97"
},
{
"height": 453,
"type": "x",
"width": 604,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=604x453"
},
{
"height": 605,
"type": "y",
"width": 807,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=807x605"
},
{
"height": 960,
"type": "z",
"width": 1280,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=1280x960"
},
{
"height": 1920,
"type": "w",
"width": 2560,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=2560x1920"
},
{
"height": 97,
"type": "o",
"width": 130,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=130x97"
},
{
"height": 150,
"type": "p",
"width": 200,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=200x150"
},
{
"height": 240,
"type": "q",
"width": 320,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=320x240"
},
{
"height": 382,
"type": "r",
"width": 510,
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu&cs=510x382"
}
],
"text": "AutoTestImage",
"user_id": 100,
"web_view_token": "13475c6ff6a2421d42",
"has_tags": false,
"orig_photo": {
"height": 1920,
"type": "base",
"url": "https://sun9-38.userapi.com/s/v1/ig2/A0JdYbr6lxHvLdC6DlrNoC3y2qa-W-TIyotYztuH9zRhQEmA1B4gsTImrFiNTdNtd6cFazDTc1ay6yUckCcWXD4B.jpg?quality=96&as=32x24,48x36,72x54,108x81,160x120,240x180,360x270,480x360,540x405,640x480,720x540,1080x810,1280x960,1440x1080,2560x1920&from=bu",
"width": 2560
}
}
]
}
```