Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

611 B
Raw Blame
import md5 from 'md5'

export const GRAVATAR_MANAGE_URL = 'https://gravatar.com/profile/avatars'

export function gravatarUrl(identifier: string, refreshKey?: number): string {
    const hash = md5(identifier.trim().toLowerCase())
    const url = `https://www.gravatar.com/avatar/${hash}?s=96&d=404`
    return refreshKey ? `${url}&_=${refreshKey}` : url
}

export function probeImage(url: string): Promise<boolean> {
    return new Promise((resolve) => {
        const image = new Image()
        image.onload = () => resolve(true)
        image.onerror = () => resolve(false)
        image.src = url
    })
}