imageWidth method

  1. @DefineMethod(name: 'image-width')
Dimension imageWidth (
  1. Quoted filePathNode
)
@DefineMethod(name: 'image-width')

Gets the image width from a file.

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

Implementation

@DefineMethod(name: 'image-width')
Dimension imageWidth(Quoted filePathNode) {
  final size = imageSizeFtn(filePathNode);
  return size == null ? null : Dimension(size.width, 'px');

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