Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»PHP»HOw to Get Gravatar Image with PHP

    HOw to Get Gravatar Image with PHP

    By RahulJune 3, 20191 Min Read

    When you are creating an application and want to display the user’s image on their profile picture. This can be a better option for you to take users image from there Gravatar account, from where we can simply get the image using their email address.

    Advertisement

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <?php
     
    $email_id = "[email protected]";
    $default = "";
    $size = 200;
     
    $gravatar_url = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?d=" . urlencode($default) . "&s=" . $size;
     
    header("content-type: image/jpeg");
    echo file_get_contents($gravatar_url);
    ?>

    Copy the above PHP script and use in your php code to show users gravatar in their profiles.

    Gravtar PHP
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    PHP Arrays: A Beginner’s Guide

    Running Laravel Queue Worker as a Systemd Service

    How to Change PHP Session Timeout

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Configure Postfix to Use Gmail SMTP on Ubuntu & Debian
    • PHP Arrays: A Beginner’s Guide
    • Deploying Flask Application on Ubuntu (Apache+WSGI)
    • OpenSSL: Working with SSL Certificates, Private Keys and CSRs
    • How to Create and Read List in Python
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.