Resizing an image with cropping

Append scale/ to your image transformation URL to resize the image, cropping it if necessary.

Procedure

  1. Write the image transformation base URL, for example, http://localhost/cidpath/.
  2. Append scale/ to the URL.
  3. To resize the image to a specified width while preserving its aspect ratio, append WIDTH/, where WIDTH is the desired target width (which must be smaller than the original width). The height is automatically calculated to preserve the aspect ratio.

    For example, here's a 535 by 600 pixel image with a scale/100 command applied to it. The resulting size is 100 by 112 pixels:

  4. Alternatively, to resize the image to a rectangle of a specified width and height, append WIDTHxHEIGHT/, where WIDTH is the desired target width of the rectangle and HEIGHT is its desired height (each of which must be smaller than the original width or height, respectively). If the aspect ratio does not allow for the image to fit within the specified rectangle, the image will be trimmed until it fits. The rectangle will always be completely filled.

    For example, here's a 535 by 600 pixel image with a scale/100x100 command applied to it. The resulting size is 100 by 100 pixels, with the bottom 12 pixels of the resized image trimmed off to make it fit:

  5. Alternatively, to resize the image to a specified height while preserving its aspect ratio, append xHEIGHT/, where HEIGHT is the desired target height (which must be smaller than the original height).

    For example, here's a 535 by 600 pixel image with a scale/x100 command applied to it. The resulting size is 89 by 100 pixels:

  6. Do one of the following:
    • Append source/ followed by the alias of a location or image. If the alias refers to a location, also append a path (optionally) and a file name (mandatory). For example, source/logo, source/repository/myfile.jpg or source/imageroot/myfolder/myfile.png.
    • Append the full URL of an image, for example, www.example.com/images/example.gif or, if the URL uses the HTTPS protocol, https://www.example.com/images/example.gif.