How to Get Gravatar Image Using PHP

How to Get Gravatar Image Using PHP

Get Gravatar Image using PHP, We can get this by simply generating gravatar URL with email id. Then use this URL in image source attribute to display gravatar image in the browser.

First of all, store email address in a variable. Remove any spaces in email address using trim PHP function. And convert all the letters to lower case if any by using strtolower PHP function. Then convert this email string into md5 hash using md5 PHP function.

Add this md5 hash after the URL “”your-md5-hash-here And if you want to get image with any custom sizes add this query term after md5 hash (?s=150) Use this above URL in source attribute of the image tag.

Assign your email id into a variable.

Then convert this email id into md5 hash using these functions.

Set image size.

Generate gravatar URL.

Open this URL in new tab to check gravatar image. Or else yo can echo this url inside image tag source attribute.

Complete Code

If you have any problem assembling above code, you can use this below code.

If you still have any problem, let me know through comment form below.

https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1839 64QhZhH0_7F0AlKdwaVj47oQIohCAwV-kd-4xsbkUCwOH1xPd_8UMFKMjwYxTAJG f08a53e1402772b02b064f33d95a5432c02c2370&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
Vivek Vengala

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: