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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

APIavatarMultiavatar
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

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.