Apidog Docs
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
HomeLearning CenterSupport CenterAPI References
HomeLearning CenterSupport CenterAPI References
Discord Community
Slack Community
X / Twitter
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
  1. Learning Center
  • Back to home
  • Dynamic values Modules
  • Airline
  • Animal
  • Color
  • Commerce
  • Company
  • Database
  • Datatype
  • Date
  • Finance
  • Food
  • Git
  • Hacker
  • Helpers
  • Image
  • Internet
  • Location
  • Lorem
  • Music
  • Number
  • Person
  • Phone
  • Science
  • String
  • System
  • Vehicle
  • Word
  1. Learning Center

Image

Module to generate images.
Overview
For a random image, use {{$image.url}}. This will not return the image directly but a URL pointing to an image from one of two demo image providers "Picsum" and "LoremFlickr". You can request an image specifically from one of two providers using {{$image.urlLoremFlickr}} or {{$image.urlPicsumPhotos}}.
For a random placeholder image containing only solid color and text, use {{$image.urlPlaceholder}} (uses a third-party service) or {{$image.dataUri}} (returns a SVG string).
For a random user avatar image, use {{$image.avatar}}.
This module previously also contained methods for specifically themed images like "fashion" or "food", but these are now deprecated. If you need more control over image type, you can request categorized images using {{$image.urlLoremFlickr}}, use an image provider directly or provide your own set of placeholder images.

avatar#

Generates a random avatar image url.
Returns: string
Examples

avatarGitHub#

Generates a random avatar from GitHub.
Returns: string
Examples

avatarLegacy#

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

dataUri#

Generates a random data uri containing an URL-encoded SVG image or a Base64-encoded SVG image.
Parameters
NameTypeDefaultDescription
colorstring{{$color.rgb}}TThe color of the image. Must be a color supported by svg.
heightnumber{{$number.int(min=1,max=3999)}}The height of the image.
type'svg-uri' | 'svg-base64'{{$helpers.arrayElements(['svg-uri','svg-base64'])}}The width of the image.
widthnumber{{$number.int(min=1,max=3999)}}The width of the image.
Returns: string
Examples

url#

Generates a random image url.
Parameters
NameTypeDefaultDescription
heightnumber{{$number.int(min=1,max=3999)}}The height of the image.
widthnumber{{$number.int(min=1,max=3999)}}The width of the image.
Returns: string
Examples

urlLoremFlickr#

Generates a random image url provided via https://loremflickr.com.
Parameters
NameTypeDefaultDescription
categorystringCategory to use for the image.
heightnumber{{$number.int(min=1,max=3999)}}The height of the image.
widthnumber{{$number.int(min=1,max=3999)}}The width of the image.
Returns: string
Examples

urlPicsumPhotos#

Generates a random image url provided via https://picsum.photos.
Parameters
NameTypeDefaultDescription
blur0 | 10 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9{{$number.int(max=10)}}Whether the image should be blurred. 0 disables the blur.
grayscaleboolean{{$datatype.boolean}}Whether the image should be grayscale.
heightnumber{{$number.int(min=1,max=3999)}}The height of the image.
widthnumber{{$number.int(min=1,max=3999)}}The width of the image.
Returns: string
Examples

urlPlaceholder#

Generates a random image url provided via https://via.placeholder.com/.
Parameters
NameTypeDefaultDescription
backgroundColorstring{{$color.rgb(prefix=' ',format='hex')}}The background color of the image.
format'gif' | 'jpeg' | 'jpg' | 'png' | 'webp'{{$helpers.arrayElement(['gif','jpeg','jpg','png','webp'])}}The format of the image.
heightnumber{{$number.int(min=1,max=3999)}}The height of the image.
textnumber{{$color.rgb(prefix=' ',format='hex')}}The text to display on the image.
textColorstring{{$number.int(min=1,max=3999)}}TThe text color of the image.
widthnumber{{$number.int(min=1,max=3999)}}The width of the image.
Returns: string
Examples

Previous
Helpers
Next
Internet
Built with