Skip to content

Instantly share code, notes, and snippets.

@SpEcHiDe
Created January 12, 2017 00:30
Show Gist options
  • Save SpEcHiDe/2a5a51b8727195408b8b8cccfd2d400b to your computer and use it in GitHub Desktop.
Save SpEcHiDe/2a5a51b8727195408b8b8cccfd2d400b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>gravatar api</title>
</head>
<body>
<form method="POST">
email: <input type="text" name="emailid"><br>
size: <select name="size">
<?php
for($i = 2048; $i > 0; $i--){
if($i == 80){
echo "<option value='$i' selected>$i</option>";
}
else{
echo "<option value='$i'>$i</option>";
}
}
?>
</select><br>
<input type="Submit" value="generate image">
</form>
<?php
if(isset($_POST['emailid'])){
$email = $_REQUEST['emailid'];
$size = $_REQUEST['size'];
$grav_url = "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?s=" . $size;
echo "\n\t<img src='$grav_url' alt='$email'>";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment