示例#1
0
 /**
  * @param string $email
  * @param string $size
  * @param string $default
  *
  * @return string
  */
 public function getImage($email, $size = '250', $default = null)
 {
     $localDefault = $this->devMode ? 'https://www.mautic.org/media/images/default_avatar.png' : $this->avatarHelper->getDefaultAvatar(true);
     $url = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $size;
     if ($default === null) {
         $default = $localDefault;
     }
     $default = strpos($default, '.') !== false && strpos($default, 'http') !== 0 ? UrlHelper::rel2abs($default) : $default;
     $url .= '&d=' . urlencode($default);
     return $url;
 }
示例#2
0
 /**
  * @param string $email
  * @param string $size
  * @param string $default
  *
  * @return string
  */
 public function getImage($email, $size = '250', $default = null)
 {
     $localDefault = $this->devMode || in_array($this->request->getClientIp(), array_merge($this->devHosts, ['127.0.0.1', 'fe80::1', '::1'])) ? 'https://www.mautic.org/media/images/default_avatar.png' : $this->avatarHelper->getDefaultAvatar(true);
     $url = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $size;
     if ($default === null) {
         $default = $localDefault;
     }
     $default = strpos($default, '.') !== false && strpos($default, 'http') !== 0 ? UrlHelper::rel2abs($default) : $default;
     $url .= '&d=' . urlencode($default);
     return $url;
 }