Important changes in image URL paths

Clients manipulating or replacing URLs are strongly recomended to read more.

Image sizes

Description:

The image-size resource is a configuration service that allows you manipulate images URLs to get image in alternative physical sizes.

It provides data necessary to do string replacement on the original image URL to get a new URL to a different image size.

Responsive web and Apps need images in a variety of sizes to provide a good user experience and reduce network load. By using this simple configuration service you can choose from images ranging from 80px to 1598 px

Location:

The image-size workspace in the Service Document contains a link to the image-size resource:

  1. <workspace>
  2. <atom:title>image-size</atom:title>
  3. <atom:link href="https://cache.api.finn.no/iad/image/size" rel="description" type="application/json"/>
  4. </workspace>

Sample:

An example of a typical output:

  1. {
  2. "pattern": "/dynamic/default/",
  3. "availableSizes": [
  4. {
  5. "width": 80,
  6. "replacement": "/dynamic/80w/"
  7. },
  8. {
  9. "width": 228,
  10. "replacement": "/dynamic/228w/"
  11. },
  12. {
  13. "width": 320,
  14. "replacement": "/dynamic/320w/"
  15. },
  16. {
  17. "width": 400,
  18. "replacement": "/dynamic/400w/"
  19. },
  20. {
  21. "width": 480,
  22. "replacement": "/dynamic/480w/"
  23. },
  24. {
  25. "width": 640,
  26. "replacement": "/dynamic/640w/"
  27. },
  28. {
  29. "width": 960,
  30. "replacement": "/dynamic/960w/"
  31. },
  32. {
  33. "width": 1280,
  34. "replacement": "/dynamic/1280w/"
  35. },
  36. {
  37. "width": 1600,
  38. "replacement": "/dynamic/1600w/"
  39. }
  40. ]
  41. }

Methods:

GET
HEAD

Parameters:

No query parameters available.

Implementation:

The preferred way to use the API is:

  1. Get the image-size workspace from the Service Document
  2. Get the image-size resource from the link in the workspace
  3. Get the pattern value from the resource
  4. Get the most appropriate image-size from the list of availableSizes: Let's say you want images that are at least 300 px wide. Iterate over the width-values and pick your best match for replacement (here: /dynamic/320w/)
  5. Replace the pattern with the replacement in the original image URL

Point 1-4 only executed during application start-up.

© 1996 - 2022 FINN.no AS