Images
Whenever an image URL is supplied in an API response, it will have a format similar to:
http://images.travelfusion.com/?url=aHR0c
If this URL is served direct to the user, the original image will be displayed. However, various parameters can be added to the URL, to specify re-sizing and cropping of the image. The actual modification of the image will be done by Travelfusion before serving the image and will therefore minimise the download size for the client.
For example, to change the above image to width 100 and height 50, the URL would need to be adjusted to:
http://images.travelfusion.com/?url=aHR0c&x=100&y=50
If it is required to scale the image to a width 100 and height 50, maintaining the aspect ratio, the URL would need to be adjusted to:
http://images.travelfusion.com/?url=aHR0c&action=resize&x=100&y=50
Specification
http://images.travelfusion.com/?url=[URL]&action=[actions]&x=[width]&y=[height]
x(optional): the width desired
y(optional): the height desired
If x and/ or y are specified, without an 'action', Travelfusion will resize the image to the specified dimension(s) using a default (best) method.
action(optional):
resize_crop: Resizes (keeping aspect ratio) and THEN crops (i.e. changing aspect ratio) to the specified width/height. This requires both x and y dimensions.
resize: Resizes (keeping aspect ratio), but does not crop. (The image is resized such that 1 dimension is equal to the specified value, and the other dimension is within the specified value)
resize_noratio: Resizes the width and height independently to the requested size. Aspect ratio is therefore not retained.
Examples
Original Image:
URL: http://images.travelfusion.com/?url=aHR0cDovL2ltYWdlcy50cmF2ZWxmdXNpb24uY29tL2V4YW1wbGUuanBn
Resize Crop (Default, Best Option)
URL: http://images.travelfusion.com/?url=...&action=resize_crop&x=420&y=420
Resize (Keeping Aspect Ratio)
URL: http://images.travelfusion.com/?url=...&action=resize&x=420&y=420
Resize (Without keeping aspect ratio)
URL: http://images.travelfusion.com/?url=...&action=resize_noratio&x=420&y=420