2014-06-23 16:32:14 +02:00
<! DOCTYPE html >
< html >
< head >
< meta charset = " UTF-8 " />
<!-- < meta http - equiv = " refresh " content = " 60 " /> -->
< meta name = " description " content = " This is simple PHP script to convert email address into Gravatar link and show the result. This is inspired by asaph/gravatar/ and the documentation it linked to and I wanted to see could I do this by myself too. " />
< title > Email --> Gravatar </ title >
</ head >
< body >
< p >
< form action = " gravatar.php " method = " post " >
2014-06-30 12:01:02 +02:00
* Email address : < input type = " text " name = " email " >< br >
Size : < input type = " text " name = " size " >
2014-06-23 16:32:14 +02:00
< input type = " submit " >
</ form >
</ p >
2014-06-30 12:01:02 +02:00
< p >* marks required field . Only email address is required .</ p >
< p > Size can be anything from 1 to 2048. If it ' s empty , size is
2014-06-30 12:08:52 +02:00
80. </ p >
2014-06-30 12:01:02 +02:00
< p > For Steam profile pictures , set size as 184. </ p >
2014-06-23 16:32:14 +02:00
</ body >
</ html >
< ? php
$email = trim ( $_REQUEST [ " email " ] );
2014-06-30 12:01:02 +02:00
$size = $_REQUEST [ " size " ];
2014-06-23 16:32:14 +02:00
2014-06-30 12:01:02 +02:00
echo " <p>Email<br> $email <br></p> " ;
2014-06-23 16:32:14 +02:00
$email = strtolower ( $email );
$md5email = md5 ( $email );
2014-06-24 07:47:51 +02:00
// Do nothing if our md5 is an empty string!
if ( $md5email != " d41d8cd98f00b204e9800998ecf8427e " ) {
2014-06-23 16:32:14 +02:00
echo " <p>md5<br> $md5email </p> " ;
echo " <p>Link<br> " ;
2014-06-30 12:01:02 +02:00
$gravatar = " https://gravatar.com/avatar/ $md5email ?s= $size .jpeg " ;
2014-06-23 16:32:14 +02:00
echo " $gravatar </p> " ;
echo " <p> " ;
echo " <img src= $gravatar > " ;
echo " </p> " ;
2014-06-24 07:47:51 +02:00
}
2014-06-24 08:19:14 +02:00
echo ' < hr />
< p >< a href = " https://github.com/Mkaysi/mkaysi.github.io/blob/master/php/gravatar.php " > Source : https :// github . com / Mkaysi / mkaysi . github . io / blob / master / php / gravatar . php </ a ></ p >
< hr /> ' ;
2014-06-23 16:32:14 +02:00
?>