imageSize method

  1. @DefineMethod(name: 'image-size')
Expression imageSize (
  1. Quoted filePathNode
)
@DefineMethod(name: 'image-size')

Gets the image dimensions from a file.

Parameters: string: the file to get the dimensions for. Returns: dimension Example: image-size("file.png"); Output: 10px 10px

Implementation

@DefineMethod(name: 'image-size')
Expression imageSize(Quoted filePathNode) {
  final size = imageSizeFtn(filePathNode);
  return size == null
      ? null
      : Expression(
          <Node>[Dimension(size.width, 'px'), Dimension(size.height, 'px')]);

//2.4.0 20150321
//  "image-size": function(filePathNode) {
//      var size = imageSize(this, filePathNode);
//      return new Expression([
//          new Dimension(size.width, "px"),
//          new Dimension(size.height, "px")
//      ]);
//  },
}