Search this site
Embedded Files
Fast API Documentation
  • 'Fast API' - Overview
    • Images
  • Change Record
  • Connection Guide
    • HTTP cookies submit example
    • HTTP request gzip example
  • Dynamic Filters and Filtering
  • Flight API Specification
  • Fusion API Platform
  • Fuzzy Ranking and Filtering
  • Hotel API Specification June 2012
    • Hotel Details Element
    • Hotel Result Modification
    • Hotel Search Example XML
      • Hotel Availability Search Example XML
      • Hotel Details Request Example XML
      • Hotel Filter, Sort and Paging Example XML
      • Hotel Only Search Example XML
      • Hotel Results Static Linking Example XML
      • Hotel Search Location Resolution Example XML
      • Obtaining a Login Token
  • Hotel API Specification October 2011
  • Hotel Results Polling Example XML
  • Location Resolution
  • Prepackaged API Spec
  • Referral and Acquisition Tracking
  • Terms, Conditions and Guidelines
  • TF Tracking Benefits
Fast API Documentation

Fast API - Overview >

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

Report abuse
Page details
Page updated
Report abuse