Location: PHPKode > scripts > libgravatar > gravatar.php
<?php

class Gravatar{
	var $email;
	var $size;
	var $rating;
	var $default;
	
	function getGravatar(){
		/* if not set to default var */
		if (empty($this->rating)) $this->rating="G";
		if (empty($this->size)) $this->size="40";
		//check email
		if(!preg_match('/^[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}$/', $this->email)){
			die ("Email inserita non correttamente");
		}
		
		$grav_url = "http://www.gravatar.com/avatar.php?
		gravatar_id=".md5(strtolower($this->email)).
		"&default=".urlencode($this->default)."&size=".$this->size;
		
		return $grav_url;
		
	}
}


?>
Return current item: libgravatar