Supported formats: JPG, PNG, GIF, BMP.
Limits: not more than
5 photos at a time, height + width not more than 14000 px, file size up to 50 Mb.
POST request field:
file{i}, i=[1..5].
Call the
photos.getUploadServer method to get an upload address.
To upload a photo to a community specify the community ID in the
group_id parameter.
Send files to the
upload_url address received in the previous step forming a POST request with
file1-
file5 fields. These fields should contain images in multipart/form-data format.
When uploaded successfully server returns a JSON object with
server,
photos_list,
hash,
aid fields:
{
- "server":123456,
- "photos_list":"[{\"photo\":\"e9f2eba71b:y\",\"sizes\":[[\"s\",\"123456852\",\"e65f\",\"Br4ir9YAvO8\",75,41],[\"m\",\"123456852\",\"e660\",\"Lqpe1N8s8zY\",130,71],[\"x\",\"123456852\",\"e661\",\"tRFbnaIP_4c\",604,330],[\"y\",\"123456852\",\"e662\",\"8JhBOy0qR6o\",748,409],[\"o\",\"123456852\",\"e663\",\"fn5KcewNluM\",130,87],[\"p\",\"123456852\",\"e664\",\"ESWOdpl7bvY\",200,133],\"kid\":\"569c3da3b168b347315aa5adc92a953a\",\"debug\":\"xsymyxyyyoypyqyry\"}]",
- "aid":98754321,
- "hash":"22b333dbbef7cd9b1f9829b5f8713f86"
}
Server and
aid fields contain numeric values,
hash is a string and
photos_list is a JSON object that should be saved as it is (but remove symbols screening before using further). In PHP
json_decode() can be used for the whole reply and then
stripslashes() for the
photos_list object.
To save photos in an album call
photos.save with
server,
photos_list,
aid,
hash received previously.
Supported formats: JPG, PNG, GIF, BMP.
Limits: not more than
6 photos at a time in
photos.saveWallPhoto method, width+height not more than 14000 px, file size up to 50 Mb.
POST request field:
photo.
Call the
photos.getWallUploadServer method to get an upload address.
To upload a photo to a community specify the community ID in the
group_id parameter.
Send files to the
upload_url address received in the previous step forming a POST request with
photo field. This field should contain an image in multipart/form-data format.
When uploaded successfully server returns a JSON object with
server,
photo,
hash fields:
{
- "server":123456,
- "photo":"[{\"photo\":\"26f1e24c4c:w\",\"sizes\":[[\"s\",\"123456852\",\"15e88\",\"01qMnm6kJ-U\",56,75],[\"m\",\"123456852\",\"15e89\",\"Y9BJ8lGrL_0\",97,130],[\"x\",\"123456852\",\"15e8a\",\"wVmxGPX0i88\",453,604],[\"y\",\"123456852\",\"15e8b\",\"ZGgaSculk1E\",605,807],[\"z\",\"123456852\",\"15e8c\",\"yl_hClRMfG8\",810,1080],[\"w\",\"123456852\",\"15e8d\",\"J1uuxjwvAKQ\",1620,2160],[\"o\",\"123456852\",\"15e8e\",\"r5KpmV_5EPM\",130,173],[\"p\",\"123456852\",\"15e8f\",\"vUIVbZdbRp0\",200,267],[\"q\",\"123456852\",\"15e90\",\"m_wtVnGD6BQ\",320,427],[\"r\",\"123456852\",\"15e91\",\"YGElZzBgEIM\",510,680]],\"kid\":\"95574768563a263c4a275f4af50a9425\",\"debug\":\"xswmwxwywzwwwowpwqwrw\"}]",
- "hash":"ed06bb07ef7a128fdae22decad8291f7"
}
Server field contains numeric value,
hash is a string,
photo is a JSON object that should be saved as it is (but remove symbols screening before using further). In PHP
json_decode() can be used for the whole reply and then
stripslashes() for the
photo object.
To save a photo call
photos.saveWallPhoto with
server, '''photo'',
hash parameters received previously. If a photo needs to be published on other user or community wall, use
user_id or
group_id parameters.
When a photo is uploaded you can place in on a wall by sending a post with
wall.post and photo id in
attachments parameter. Note that to publish a photo on another user or community wall you need to use the same
user_id and
group_id parameters as you used while calling
photos.saveWallPhoto.
Supported formats: JPG, PNG, GIF, BMP.
Limits: size not less than 200x200px, aspect ratio from 0.25 to 3, width+height not more than 14000 px, file size up to 50 Mb.
POST request field:
photo.
Call
photos.getOwnerPhotoUploadServer to receive an upload address. To upload a photo to a community send its negative id in the
owner_id parameter.
Send files to the
upload_url address received in the previous step forming a POST request with
photo field. This field should contain an image in multipart/form-data format.
Following parameters can be sent in addition:
- _square_crop in x,y,w (no quotes) format where x and y are the coordinates of the preview upper-right corner and w is square side length. That will create a square preview for a photo.
When uploaded successfully server returns a JSON object with
server,
photo,
mid,
hash,
message_code,
profile_aid fields:
{
- "server":999,
- "photo":"eyJvaWQiOjIzMTQ4NTIsInBob3RvIjp7InBob3RvIjoiZmEyZjViNmMzYjp3Iiwic2l6ZXMiOltbInMiLCI2MjY2Mjc4NTGRkMThjYTY2NjZmMjI3NTRkODAxNDUyNDUzOSJ9",
- "mid":2314852,
- "hash":"7448f93f405dfd5c444f5d4aabb84942",
- "message_code":2,
- "profile_aid":-6
}
Server,
mid,
message_code,
profile_aid are numeric values,
hash and
photo are strings.
To save a photo call
photos.saveOwnerPhoto with
server, '''photo'',
hash parameters received before.
For an IFrame application do the following:
- With Javascript SDK call photos.saveOwnerPhoto with server, photo and hash parameters. A confirmation window will appear to save a new photo. If user approves, photo is saved successfully and photo_src parameter returns. In this case there's no need to perform the next step.
If you run photos.saveOwnerPhoto through a direct API call, do the following in addition.
- Call the showProfilePhotoBox Client API method with photo_hash parameter. Application will display a window to confirm photo change.
Supported formats: JPG, PNG, GIF, BMP.
Limits: height+width not more than 14000px, file size up to 50 Ìá.
POST request field:
photo.
Call
photos.getMessagesUploadServer to receive an upload address.
Send files to the
upload_url address received in the previous step forming a POST request with
photo field. This field should contain an image in multipart/form-data format.
When uploaded successfully server returns a JSON object with
server,
photo,
hash fields:
{
- "server":626627,
- "photo":"[{\"photo\":\"190ab6eadf:w\",\"sizes\":[[\"s\",\"626627852\",\"e6a3\",\"lMU557Tx-78\",75,56],[\"m\",\"626627852\",\"e6a4\",\"hq8g5CzPmXs\",130,97],[\"x\",\"626627852\",\"e6a5\",\"c-_TPYB_rIU\",604,453],[\"y\",\"626627852\",\"e6a6\",\"960UqY34tOE\",807,605],[\"o\",\"626627852\",\"e6a9\",\"hKHFCLV76WA\",130,98],[\"p\",\"626627852\",\"e6aa\",\"SdMDnYrCWLQ\",200,150],\"kid\":\"72cfb87071e2d6624a38167524d5b4aa\",\"debug\":\"xswmwxwywzwwwowpwqwrw\"}]",
- "hash":"581d7a4ffc81e2bfe90016d8b35c288d"
}
Server field contains numeric value,
hash is a string,
photo is a JSON object that should be saved as it is (but remove symbols screening before using further). In PHP
json_decode() can be used for the whole reply and then
stripslashes() for the
photo object.
To save a photo call
photos.saveMessagesPhoto with
server,
photo and
hash parameters received previously.
After successful upload you may attach the photo to a private message with
messages.send and photo info in
attachments.
Continue