OpenWGA 7.2 - TMLScript reference

ImageScaler
Method :

scaleToSize(width, height [, keepRatio])

On object ImageScaler
Usage Scales the image to an absolute target size
Description This is a straightforward scaling method that will make the image scale to the exact given sizes, at least if it is not instructed to keep the aspect ratio.

If the aspect ratio should be kept - controllable on parameter "keepRatio" - the following behaviour is enforced:

  • On images with "landscape" format (width > height) the image is scaled to the given parameter width while the height is a result of keeping the aspect ratio at that width. The height parameter is ignored in that case.
  • On images with "portrait" format (height > width) the image is scaled to the given parameter height while the width is a result of keeping the aspect ratio at that height. The width parameter is ignored in that case
Parameters width (Number):
Desired width of the image in pixels

height (Number):
Desired height of the image in pixels

keepRatio (Boolean, optional):
Controls if the aspect ratio of the image is to be reserved. See description for behaviour when true.
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
    portletevent