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.
1 2 3 4 5 6 7 8 9 10 11 | <?php $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); ?> |
Advertisement
Copy the above PHP script and use in your php code to show users gravatar in their profiles.