public function buildGravatarURL($email, $hash_email = true)
	{
		// Start building the URL, and deciding if we're doing this via HTTPS or HTTP.
		if($this->usingSecureImages())
		{
			$url = static::HTTPS_URL;
		}
		else
		{
			$url = static::HTTP_URL;
		}

		// Tack the email hash onto the end.
		if($hash_email == true && !empty($email))
		{
			$url .= $this->getEmailHash($email);
		}
		elseif(!empty($email))
		{
			$url .= $email;
		}
		else
		{
			$url .= str_repeat('0', 32);
		}

		// Check to see if the param_cache property has been populated yet
		if($this->param_cache === NULL)
		{
			// Time to figure out our request params
			$params = array();
			$params[] = 's=' . $this->getAvatarSize();
			$params[] = 'r=' . $this->getMaxRating();
			if($this->getDefaultImage())
			{
				$params[] = 'd=' . $this->getDefaultImage();
			}

			// Stuff the request params into the param_cache property for later reuse
			$this->params_cache = (!empty($params)) ? '?' . implode('&', $params) : '';
		}

		// Handle "null" gravatar requests.
		$tail = '';
		if(empty($email))
		{
			$tail = !empty($this->params_cache) ? '&f=y' : '?f=y';
		}

		// And we're done.
		return $url . $this->params_cache . $tail;
	}
public function buildGravatarURL($email, $hash_email = true)
	{
		// Start building the URL, and deciding if we're doing this via HTTPS or HTTP.
		if($this->usingSecureImages())
		{
			$url = static::HTTPS_URL;
		}
		else
		{
			$url = static::HTTP_URL;
		}

		// Tack the email hash onto the end.
		if($hash_email == true && !empty($email))
		{
			$url .= $this->getEmailHash($email);
		}
		elseif(!empty($email))
		{
			$url .= $email;
		}
		else
		{
			$url .= str_repeat('0', 32);
		}

		// Check to see if the param_cache property has been populated yet
		if($this->param_cache === NULL)
		{
			// Time to figure out our request params
			$params = array();
			$params[] = 's=' . $this->getAvatarSize();
			$params[] = 'r=' . $this->getMaxRating();
			if($this->getDefaultImage())
			{
				$params[] = 'd=' . $this->getDefaultImage();
			}

			// Stuff the request params into the param_cache property for later reuse
			$this->params_cache = (!empty($params)) ? '?' . implode('&', $params) : '';
		}

		// Handle "null" gravatar requests.
		$tail = '';
		if(empty($email))
		{
			$tail = !empty($this->params_cache) ? '&f=y' : '?f=y';
		}

		// And we're done.
		return $url . $this->params_cache . $tail;
	}
public function buildGravatarURL ( $ email , $ hash_email = true ) { // Start building the URL, and deciding if we're doing this via HTTPS or HTTP. if ( $ this -> usingSecureImages ( ) ) { $ url = static :: HTTPS_URL ; } else { $ url = static :: HTTP_URL ; } // Tack the email hash onto the end. if ( $ hash_email == true && ! empty ( $ email ) ) { $ url .= $ this -> getEmailHash ( $ email ) ; } elseif ( ! empty ( $ email ) ) { $ url .= $ email ; } else { $ url .= str_repeat ( '0' , 32 ) ; } // Check to see if the param_cache property has been populated yet if ( $ this -> param_cache === NULL ) { // Time to figure out our request params $ params = array ( ) ; $ params [ ] = 's=' . $ this -> getAvatarSize ( ) ; $ params [ ] = 'r=' . $ this -> getMaxRating ( ) ; if ( $ this -> getDefaultImage ( ) ) { $ params [ ] = 'd=' . $ this -> getDefaultImage ( ) ; } // Stuff the request params into the param_cache property for later reuse $ this -> params_cache = ( ! empty ( $ params ) ) ? '?' . implode ( '&' , $ params ) : '' ; } // Handle "null" gravatar requests. $ tail = '' ; if ( empty ( $ email ) ) { $ tail = ! empty ( $ this -> params_cache ) ? '&f=y' : '?f=y' ; } // And we're done. return $ url . $ this -> params_cache . $ tail ; }
Build the avatar URL based on the provided email address.
@param string $email - The email to get the gravatar for.
@param string $hash_email - Should we hash the $email variable?  (Useful if the email address has a hash stored already)
@return string - The XHTML-safe URL to the gravatar.
Build the avatar URL based on the provided email address .