switchvox.users.profile.images.updateCrop
From SwitchvoxExtendAPI
Contents |
Description
Updates the crop coordinates of an image and creates copies of the cropped file in various sizes. The crop coordinates must define a box at least 150 by 200 pixels with an aspect ratio of 3:4.
Arguments
- See the Constructing Requests page to learn how to use arguments in requests.
| Name | Required | Type | Default | Description |
| image_id | required | integer | The id of the image to crop. | |
| account_id | required | integer | Id of the calling account. | |
| x1 | required | integer | The left x of the coordinates that define crop definition box. | |
| y1 | required | integer | The top y of the coordinates that define crop definition box. | |
| x2 | required | integer | The right x of the coordinates that define crop definition box. | |
| y2 | required | integer | The bottom y of the coordinates that define crop definition box. |
Example Requests & Responses
- Please see the API Request and Response Format section for more information on various request encodings.
Example One
Request
Crop image with id of 5 by account_id 1101.
<request method="switchvox.users.profile.images.updateCrop"> <parameters> <image_id>5</image_id> <account_id>1101</account_id> <image_type>profile</image_type> <x1>252</x1> <y1>306</y1> <x2>543</x2> <y2>693</y2> </parameters> </request>
Response
Upon success URLs to where all the newly created images can be viewed are returned.
<response method="switchvox.users.profile.images.updateCrop"> <result> <image id="5" type="profile"> <size name="source" link="https://10.10.3.43/dl?cmd=profile_image&id=5&size=source&hash=c0e51dfb0b64d6890993441cbdbb0287" width="750" height="1000" /> <size name="360X480" link="https://10.10.3.43/dl?cmd=profile_image&id=5&size=scale_360X480&hash=c0e51dfb0b64d6890993441cbdbb0287" width="360" height="480" /> <size name="240X320" link="https://10.10.3.43/dl?cmd=profile_image&id=5&size=scale_240X320&hash=c0e51dfb0b64d6890993441cbdbb0287" width="240" height="320" /> <size name="150X200" link="https://10.10.3.43/dl?cmd=profile_image&id=5&size=scale_150X200&hash=c0e51dfb0b64d6890993441cbdbb0287" width="150" height="200" /> <size name="120X160" link="https://10.10.3.43/dl?cmd=profile_image&id=5&size=scale_120X160&hash=c0e51dfb0b64d6890993441cbdbb0287" width="120" height="160" /> <size name="90X120" link="https://10.10.3.43/dl?cmd=profile_image&id=5&size=scale_90X120&hash=c0e51dfb0b64d6890993441cbdbb0287" width="90" height="120" /> <size name="cropped" link="https://10.10.3.43/dl?cmd=profile_image&id=5&size=cropped&hash=c0e51dfb0b64d6890993441cbdbb0287" width="292" height="388" /> </image> </result> </response>
Error Codes
- See the Error Code Formatting section to see the xml structure when an error is returned.
- See the Generic Error Codes section to see a list of general fault codes that may be returned.
| Code | Description |
| 59025 | Invalid image id (%1). |
| 10014 | Invalid account_id (%1). Account_ids may only contain digits. |
| 84711 | That account_id is invalid. |
| 84147 | You cannot modify/delete images that are attached an account other than yours. |
| 92107 | Crop coordinates must define a box at least 75 by 100 pixels with an aspect ratio of 3:4. |
| 25516 | The x2 crop coordinate must be larger than the x1 coordinate. |
| 16285 | The y2 crop coordinate must be larger than the y1 coordinate. |
| 64073 | Error cropping image. Please check pixel options. |
| 86405 | Error scaling image. Please check pixel options. |