Skip to main content

image Domain

The image domain maps domain keywords to underlying faker implementations.

Faker Documentation

Methods

image.avatar

Generates a random avatar image url.

No parameters.

Examples:

image.avatar()

Example return values:

  • "https://avatars.githubusercontent.com/u/4737631"
  • "https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/male/512/74.jpg"

image.avatarGitHub

Generates a random avatar from GitHub.

No parameters.

Examples:

image.avatarGitHub()

Example return values:

  • "https://avatars.githubusercontent.com/u/21478609"
  • "https://avatars.githubusercontent.com/u/94618277"

image.avatarLegacy

Generates a random avatar from https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar.

No parameters.

Examples:

image.avatarLegacy()

Example return values:

  • "https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/498.jpg"
  • "https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/217.jpg"

image.dataUri

Generates a random data uri containing an URL-encoded SVG image or a Base64-encoded SVG image.

No parameters.

Examples:

image.dataUri()

Example return values:

  • "data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%222411%22%20height%3D%222600%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22%23d474ad%22%2F%3E%3Ctext%20x%3D%221205.5%22%20y%3D%221300%22%20font-size%3D%2220%22%20alignment-baseline%3D%22middle%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%3E2411x2600%3C%2Ftext%3E%3C%2Fsvg%3E"
  • "data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%222648%22%20height%3D%223613%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22%23fe202c%22%2F%3E%3Ctext%20x%3D%221324%22%20y%3D%221806.5%22%20font-size%3D%2220%22%20alignment-baseline%3D%22middle%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%3E2648x3613%3C%2Ftext%3E%3C%2Fsvg%3E"

image.personPortrait

Generates a random square portrait (avatar) of a person.

No parameters.

Examples:

image.personPortrait()

Example return values:

  • "https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/97.jpg"
  • "https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/72.jpg"

image.url

Generates a random image url.

ArgTypeRequiredDescription
heightnumbernoThe height of the image.
widthnumbernoThe width of the image.

Examples:

image.url()
image.url(height=1, width=1)

Example return values:

  • "https://loremflickr.com/2047/2524?lock=8418418111332618"
  • "https://loremflickr.com/3726/3449?lock=1810011656215161"

image.urlLoremFlickr

Generates a random image url provided via https://loremflickr.com.

No parameters.

Examples:

image.urlLoremFlickr()

Example return values:

  • "https://loremflickr.com/3246/1034?lock=1014047844060749"
  • "https://loremflickr.com/89/2631?lock=4768337721421349"

image.urlPicsumPhotos

Generates a random image url provided via https://picsum.photos.

No parameters.

Examples:

image.urlPicsumPhotos()

Example return values:

  • "https://picsum.photos/seed/s2F0L/2185/1092?blur=7"
  • "https://picsum.photos/seed/BGb8i/639/1119?blur=6"

image.urlPlaceholder

Generates a random image url provided via https://via.placeholder.com/.

No parameters.

Examples:

image.urlPlaceholder()

Example return values:

  • "https://via.placeholder.com/954x3055/45ad7e/fcd4eb.png?text=incidunt%20eos%20id"
  • "https://via.placeholder.com/234x1659/9dd0fd/de5f36.gif?text=agnitio%20decretum%20undique"