Provides utility functions for retrieving data about images.

Constructors

Methods

Constructors

Methods

  • Loads given URLs into image elements returning those that resolved with width & height dimensions. This is useful when the size of an image is necessary before usage.

    Parameters

    • urls: string | { url?: string } | Iterable<string | { url?: string }>

      A list of image URLS to load or object with an url property.

    • Optionaloptions: { accessor?: string; warn?: boolean }

      Optional options.

      • Optionalaccessor?: string

        Accessor string to access child attribute when urls entry contains objects.

      • Optionalwarn?: boolean

        Log debug warnings when a target URL can not be determined; default: false.

    Returns Promise<
        {
            fulfilled: { height: number; url: string; width: number }[];
            rejected: { url: string }[];
        },
    >

    An object with fulfilled and rejected requests.