parseDim = (dim, maxDim, cssVar) => {
        if (!dim || dim == 'auto') {
          return '';
        }

        const ary = dim.match(/^([0-9]+)(px|%)?$/);
        if (ary) {
          if (ary[2] == '%') {
            return Math.floor(maxDim * ary[1] / 100) + 'px';
          } else if (ary[2] == 'px') {
            return dim;
          } else {
            return `calc(${dim} * var(${cssVar}))`;
          }
        }

        return '';
      }
Display an image.

Either URI or buffer or blob fields must be specified.

@param {{
    name: (string|undefined),
    size: (string|number|undefined),
    preserveAspectRation: (boolean|undefined),
    inline: (boolean|undefined),
    width: (string|number|undefined),
    height: (string|number|undefined),
    align: (string|undefined),
    url: (string|undefined),
    buffer: (!ArrayBuffer|undefined),
    blob: (!Blob|undefined),
    type: (string|undefined),
}} options The image to display.
  name A human readable string for the image
  size The size (in bytes).
  preserveAspectRatio Whether to preserve aspect.
  inline Whether to display the image inline.
  width The width of the image.
  height The height of the image.
  align Direction to align the image.
  uri The source URI for the image.
  buffer The ArrayBuffer image data.
  blob The Blob image data.
  type The MIME type of the image data.
@param {function()=} onLoad Callback when loading finishes.
@param {function(!Event)=} onError Callback when loading fails.