Viki Platform

Images

Images returned by the API have a URL that looks like http://x.viki.io/.... where x is currently either 0 or 1. It is possible to modify the image by supplying querystring parameters.

NOTE: The image path returned by the API may already contain a querystring. You must check for ? in order to know whether & or ? should be used to append additional values

Resize

Images can be resized by using the s parameter and specifying a WxH:

http://0.viki.io/viki.jpg?s=263x220

The maximum width and height is 1500. The image will be cropped if needed.

Background

By default the image will be preserve the height and adjust the width to mantain the aspect ratio. If the width is bigger than the resulting image, it will fill the rest of the image with a background color (default white). E.g. if the original image is 300x300 and you perform the following request:

http://0.viki.io/viki.jpg?s=1500x300&b=000000

it will return the original image centered, with two black bars on the sides to fill the 1500 pixels of width.

Extend

If an extend parameter (e) is true by specifying a t value, the image will fill the given size no matter what, doing cropping if necessary. The cropping will always be centered on the top of the image (North).

http://0.viki.io/viki.jpg?s=1500x300&e=t

Watermark

An watermark can be added to the image via the w parameter. The watermark type and its location must be specified:

http://0.viki.io/viki.jpg?s=263x220&w=p_ne

Valid types are:

Valid locations are:

Animated Gifs

Animated gifs can be frozen to their first scene via the f=t flag. It's safe to pass this to non-gif (or non animated-gif) images. Best when used with size.

Anchor

An anchor (or focal) point can be specified to serve as a hint for the cropping transformation. Without it, images are cropped with an anchor to the North. As Generally, this is only useful for internal tools.

http://0.viki.io/viki.jpg?s=1500x400&a=400x300

Preview

Images are aggressively cached (in Atlas and CDNs). For tools generating previews, this could have a negative impact on overall performance. Specifying p=t will ensure that the generate image isn't cached as aggressively (there's still some caching).

SSL

Images can be retrieved from the secure domains s0 and s1:

https://s0.viki.io/viki.jpg?s=263x220

(yes, we think this kinda sucks and we hope to be able to provide https over our main 0 and 1 subdomains at some point)

Head requests can be sent to determine the presence and size of an image