Basic

Display a Cloudinary-stored image as avatar

You can easily generate a version of your image as a 200x200 in size, round and auto-cropping avatar, with the following steps:

  1. Get your asset's publicId by clicking on "Link" icon in Cloudinary Console.

    Copy link icon in Cloudinary

    Or you can click on the "Settings" icon

    Select Settings

    Then select "Copy Url"

    Select Copy Url

  2. Use the copied path and generate the asset url as avatar

import { buildImageUrl } from 'cloudinary-build-url'
import { RESIZE_TYPES, Gravity } from '@cld-apis/utils'

const url = buildImageUrl('paste-the-copied-path', {
  cloud: {
    cloudName: 'your-cloud-name',
  },
  transformations: {
    resize: {
      type: RESIZE_TYPES.FILL,
      width: 200,
      height: 200,
    },
    radius: 'max',
    gravity: Gravity.Subject
  }
})