Backend Development 2 min read

Generating Random Avatars with Multiavatar API in PHP

The article explains how to discover the Multiavatar service, use browser developer tools to modify the MD5 hash in the URL to obtain different avatars, and provides a concise PHP function that returns a random avatar URL based on an email address.

php中文网 Courses
php中文网 Courses
php中文网 Courses
Generating Random Avatars with Multiavatar API in PHP

While browsing, the author discovered a website that can generate random avatars (www.atoolbox.net/Tool.php?Id=1013) and later identified the actual service at https://multiavatar.com/ with a unique MD5 hash in the URL.

Using the browser's developer tools, they observed that changing the MD5 part of the URL produces different avatar images, confirming the generation mechanism.

Based on this insight, a simple PHP helper function is provided, which computes the MD5 hash of an email address and returns the corresponding Multiavatar PNG URL.

if (!function_exists('make_avatar')) {
    function make_avatar($email)
    {
        $md5_email = md5($email);
        return "https://api.multiavatar.com/{$md5_email}.png";
    }
}

This function enables developers to easily obtain a random avatar for any user without external dependencies.

backendphpAPItutorialavatarMultiavatar
php中文网 Courses
Written by

php中文网 Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.