Expand all

ImageModel

Represents information about a single image

Constructor

new ImageModel(title, imageInfo) #

Parameters:

Name Type Description
title mw.Title

The title of the image file

imageInfo Object

Raw page object from the imageinfo API response

Source:

Properties

anonymizedUploadDateTime #

creationDateTime #

descriptionShortUrl #

Methods

getThumbnailUrl(width) → {string} #

Returns the URL of the smallest available thumbnail at least as wide as the requested width. The imageinfo API provides URLs for all supported thumbnail sizes in ImageModel#thumburls, so no separate request is needed. When no thumbnail is wide enough (or none are available), the full-size original URL is returned.

Parameters:

Name Type Description
width number

Returns:

Type
string
Source:

Returns the URL of the smallest available thumbnail at least as wide as the requested width.

parseExtmeta(data, type) → {string|number|boolean|Array}static #

Reads and parses a value from the imageinfo API extmetadata field.

Parameters:

Name Type Description
data Array
type string

one of 'plaintext', 'string', 'float', 'boolean', 'list', 'datetime'

Returns:

value or undefined if it is missing

Type
string | number | boolean | Array
Source:
Reads and parses a value from the imageinfo API extmetadata field.