
Web2Print Cloud Lab
1 Table of Contents
2 Overview
3 Endpoint
POST https://api.delivergo.com/content/api/UserFiles/Remote
4 General Usage
To edit cloud storage images you first need to construct an
Action object. This object describes the image to use and the actions that should be applied on the image. When this object is queued at the server it returns an
ActionId, which works as a reference to the current queued action. You can then use this
ActionId to construct an URI that can be used as a source to an Image element. When the URI is being accessed the processing is applied to the image and returned.
For every processing that you want to apply to the image a new
ActionId is being created so you have to constantly update the Image URI.
5 Elements
| Name | Type | Datatype | Example | Default | Description |
|---|
| ActionId
| optional
| guid
| E91F76F2-8E42-4B30-A4CF-A64A3D6D85CB
| -
| Action ID that can be used to reference the queued Image processing.
|
| Commit
| optional
| bool
| true
| false
| Commits the changes to the cloud storage to get the image up-to-date.
|
| Persist
| optional
| bool
| true
| false
| Applies the changes to the image immediately when set to true, otherwise just generates a preview of the changes.
|
| UserGuid
| required
| guid
| E91F76F2-8E42-4B30-A4CF-A64A3D6D85CB
| -
| ID of the user who's images are meant to be edited.
|
| ImageHandle
| required
| guid
| E91F76F2-8E42-4B30-A4CF-A64A3D6D85CB
| -
| The image handle which references the image.
|
| PortalGuid
| required
| guid
| E91F76F2-8E42-4B30-A4CF-A64A3D6D85CB
| -
| ID of the portal the user belongs to.
|
| Filename
| required
| string
| My Image
| -
| The name of the image. Generally this element is routed through the whole editing and is required the set the correct image name when the edited image is uploaded to the cloud storage upon completion. This element is supported by the system when listing all user images and can be changed.
|
| SessionId
| required
| string
| edb0e8665db4e9042fe0176a89aade16
| -
| Session ID in which the whole editing process is taking place. This can be used to combine multiple image edits.
|
| Rotation
| optional
| int
| 90
| 0
| Angle of rotation. Currently only 90° steps are valid values, whereas 90 results in clockwise and -90 in counterclockwise rotation.
|
| Flip
| optional
| string
| Horizontal
| -
| Type of flipping. Can be either Horizontal or Vertical.
|
| | Horizontal: Flips(mirrors) the image horizontally.
|
| | Vertical: Flips(mirrors) the image vertically.
|
| ThumbnailSize
| required
| int
| 100
| -
| Required when image is being committed to the cloud storage. This is used to store a thumbnail of the image along with the original image. The value describes a square in which the image will be resized to. Aspect ratio will be maintained.
|
| CropInfo
| optional
| element
| -
| -
| CropInfo element, contains info about how to crop the image. Described above.
|
|
5.1 Ways to apply actions
There are two ways of applying actions on the image. When setting
Persist to
true the changes will be applied to the original image. So, whenever an action is executed it will be applied on top of previous actions, meaning that multiple actions are being applied sucessively. Rotating an image by 180° would require to execute two actions with
Rotation set to
90. (Let's just forget for a while that you could use 180° as well.)
The second approach, triggered by setting
Persist to
false, applies the action to a copy of the original image and returns the edited image. The original image will never be touched. You can use this approach to preview the action before it's applied to the actual image. Rotating an image by 180° could be done by constructing an action with
Rotation set to
180.
When you're finished with all the editing you need to set
Commit to
true to trigger the upload back into the cloud storage.
6 Actions
6.1 Rotation
Currently only 90° steps(90, -90, 180, -180, 270, -270) are supported as a value to the Rotation action.
6.2 Flipping
Horizontal and vertical flipping is supported
6.3 Cropping
Left upper corner plus width and height of the viewport is supported. You also need to support the uncropped image dimensions, so the relative coordinates can be calculated
6.3.1 Elements
| Name | Type | Datatype | Example | Default | Description |
|---|
| X
| required
| int
| 10
| 0
| Horizontal coordinate of the upper left corner, which is the starting point of the cropping rectangle.
|
| Y
| required
| int
| 10
| 0
| Vertical coordinate of the upper left corner, which is the starting point of the cropping rectangle.
|
| ViewportWidth
| required
| int
| 100
| 0
| Width of the cropping rectangle.
|
| ViewportHeight
| required
| int
| 100
| 0
| Height of the cropping rectangle.
|
| ImageWidth
| required
| int
| 1024
| 0
| Uncropped width of the underlying image that should will be cropped.
|
| ImageHeight
| required
| int
| 768
| 0
| Uncropped height of the underlying image that should will be cropped.
|
|
6.4 Example
XML:
<RemoteUploadEditInfo xmlns="http://delivergo.net/content/api">
<UserGuid>281FC8B8F6C0496EAAA0430BD5D30353</UserGuid>
<SessionId>j6oAOxCWZhCD723LGeXlf</SessionId>
<ImageHandle>66107AA0FE024938824D6BBD521D4C4C</ImageHandle>
<Filename>My Image</Filename>
<Rotation>90</Rotation>
<Flip>Horizontal</Flip>
<ThumbnailSize>100</ThumbnailSize>
<PortalGuid>EAD61F458A6D4EE3971330603E061802</PortalGuid>
<Commit>true</Commit>
<CropInfo>
<X>20</X>
<Y>20</Y>
<ViewportWidth>100</ViewportWidth>
<ViewportHeight>100</ViewportHeight>
<ImageWidth>800</ImageWidth>
<ImageHeight>600</ImageHeight>
</CropInfo>
</RemoteUploadEditInfo>
JSON:
{
"UserGuid":"281FC8B8F6C0496EAAA0430BD5D30353",
"ImageHandle":"66107AA0FE024938824D6BBD521D4C4C",
"PortalGuid": "EAD61F458A6D4EE3971330603E061802",
"Filename": "My Image",
"ThumbnailSize": 100,
"SessionId":"j6oAOxCWZhCD723LGeXlf",
"Rotation":90,
"Commit": true,
"Flip": "Horizontal"
"CropInfo": {
"X": 20,
"Y": 20,
"ViewportWidth": 100,
"ViewportHeight": 100
"ImageWidth": 800,
"ImageHeight": 600
}
}
7 Rendering actions
To execute the queued action you have to construct a specific URI which will also serve as an Image source.
It has the following format:
http://api.delivergo.com/content/api/RenderImageEdit.ashx?w=800&h=600&a=fb7f488c60484c8f9aacf3c1f81508e3
7.1 Parameters
| Name | Type | Datatype | Example | Default | Description |
|---|
| portal
| required
| string
| myportal
| -
| The namespace of your portal
|
| w
| required
| int
| 800
| -
| The maximum width of the image dimensions.
|
| h
| required
| int
| 600
| -
| The maximum height of the image dimensions.
|
| a
| required
| string
| fb7f488c60484c8f9aacf3c1f81508e3
| -
| ActionId referencing the previously queued action.
|