Appwrite. Services. Avatars
(appwrite v1.0.0)
View Source
The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars.
Summary
Functions
Get a browser icon image.
Get a credit card brand logo.
Get a favicon from a remote URL.
Get a country flag image.
Get a user's gravatar based on their email address.
Get an image from a remote URL, resized and cropped to fit.
Generate initials avatar for a name.
Generate a QR code image from a string.
Take a screenshot of a webpage using a headless browser.
Functions
@spec get_browser(String.t(), integer() | nil, integer() | nil, integer() | nil) :: {:ok, String.t()} | {:error, any()}
Get a browser icon image.
Parameters
code(required) – browser code (seeAppwrite.Consts.Browser)width(optional) – image width in pixels (default 100)height(optional) – image height in pixels (default 100)quality(optional) – JPEG quality 0–100 (default 100)
@spec get_credit_card(String.t(), integer() | nil, integer() | nil, integer() | nil) :: {:ok, String.t()} | {:error, any()}
Get a credit card brand logo.
Parameters
code(required) – credit card code (seeAppwrite.Consts.CreditCard)width(optional)height(optional)quality(optional)
Get a favicon from a remote URL.
Parameters
url(required) – the website URL whose favicon to fetch
@spec get_flag(String.t(), integer() | nil, integer() | nil, integer() | nil) :: {:ok, String.t()} | {:error, any()}
Get a country flag image.
Parameters
code(required) – ISO 3166-1 two-letter country codewidth(optional)height(optional)quality(optional)
@spec get_gravatar(String.t(), integer() | nil, String.t() | nil, String.t() | nil) :: {:ok, String.t()} | {:error, any()}
Get a user's gravatar based on their email address.
Parameters
email(required)size(optional) – image size in pixels (1–2048, default 128)rating(optional) –"g","pg","r", or"x"(default"g")default(optional) – default image URL or one of the built-in defaults
@spec get_image(String.t(), integer() | nil, integer() | nil) :: {:ok, String.t()} | {:error, any()}
Get an image from a remote URL, resized and cropped to fit.
Parameters
url(required) – the source image URLwidth(optional)height(optional)
@spec get_initials( String.t() | nil, integer() | nil, integer() | nil, String.t() | nil ) :: {:ok, String.t()} | {:error, any()}
Generate initials avatar for a name.
Parameters
name(optional) – full name; falls back to current user's namewidth(optional)height(optional)background(optional) – hex color without#
@spec get_qr(String.t(), integer() | nil, integer() | nil, boolean() | nil) :: {:ok, String.t()} | {:error, any()}
Generate a QR code image from a string.
Parameters
text(required) – the text to encodesize(optional) – QR code size in pixels (1–1000, default 400)margin(optional) – quiet-zone margin in pixels (0–10, default 1)download(optional) – whentrue, response setsContent-Disposition: attachment
Take a screenshot of a webpage using a headless browser.
This is a new endpoint added in Appwrite Cloud (not present in v0.2.1).
Parameters
url(required) – the URL to screenshotopts(optional keyword list)::viewport_width– viewport width in pixels (default 1280):viewport_height– viewport height in pixels (default 800):scale– device pixel ratio (default 1):theme–"light"or"dark"(default"light"):user_agent– custom User-Agent string:fullpage– whentrue, captures the full scrollable page (defaultfalse):locale– browser locale, e.g."en-US":timezone– IANA timezone, e.g."America/New_York":latitude/:longitude– geolocation override:accuracy– geolocation accuracy in metres:touch– emulate touch events (true/false):permissions– list of browser permissions to grant:sleep– milliseconds to wait after page load before screenshotting:width– output image width in pixels:height– output image height in pixels:quality– JPEG/WebP quality 0–100:output– output format:"jpeg","png", or"webp"