Docs

Avatars

The avatars service aims to help you complete common and recitative tasks related to your app images, icons and avatars. Using this service we hope to save you some precious time and helping you focus on solving your app real challenges.

Get Credit Card Icon

GET/avatars/credit-cards/{code}

Need to display your users with your billing method or there payment methods? The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.

Arguments

Name Type Description
code required string

Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100

Example Request
  • let sdk = new Appwrite();
    
    sdk
        setProject('')
        setKey('')
    ;
    
    let promise = sdk.avatars.getCreditCard('amex');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        setProject('')
        setKey('')
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getCreditCard('amex');

Get Browser Icon

GET/avatars/browsers/{code}

You can use this endpoint to show different browser icons to your users, The code argument receives the browser code as appear in your user /account/sessions endpoint. Use width, height and quality arguments to change the output settings.

Arguments

Name Type Description
code required string

Browser Code.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100

Example Request
  • let sdk = new Appwrite();
    
    sdk
        setProject('')
        setKey('')
    ;
    
    let promise = sdk.avatars.getBrowser('aa');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        setProject('')
        setKey('')
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getBrowser('aa');

Get Country Flag

GET/avatars/flags/{code}

You can use this endpoint to show different country flags icons to your users, The code argument receives the a 2 letter country code. Use width, height and quality arguments to change the output settings.

Arguments

Name Type Description
code required string

Country Code. ISO Alpha-2 country code format.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100

Example Request
  • let sdk = new Appwrite();
    
    sdk
        setProject('')
        setKey('')
    ;
    
    let promise = sdk.avatars.getFlag('af');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        setProject('')
        setKey('')
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getFlag('af');

Get Favicon

GET/avatars/favicon

Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote website URL.

Arguments

Name Type Description
url required string

Website URL which you want to fetch the favicon from.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        setProject('')
        setKey('')
    ;
    
    let promise = sdk.avatars.getFavicon('https://example.com');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        setProject('')
        setKey('')
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getFavicon('https://example.com');

Text to QR Generator

GET/avatars/qr

Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.

Arguments

Name Type Description
text required string

Plain text to be converted to QR code image

size optional integer

QR code size. Pass an integer between 0 to 1000. Defaults to 400.

margin optional integer

Margin From Edge. Pass an integer between 0 to 10. Defaults to 1.

download optional integer

Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading the image. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.

Example Request