Get gravatar url.

@param int    $size
@param string $default
@param string $rating

@return string
492483
public function gravatar($size = 60, $default = 'mm', $rating = 'g')
    {
        $email = $this->email;

        return 'http://www.gravatar.com/avatar/'.md5(strtolower(trim($email)))."?s={$size}&d={$default}&r={$rating}";
    }
748340
public static function get_gravatar($email, $size = 32)
    {
        if (self::is_https()) {
            $url = 'https://secure.gravatar.com/';
        } else {
            $url = 'http://www.gravatar.com/';
        }

        $url .= 'avatar/' . md5($email) . '?s=' . (int) abs($size);

        return $url;
    }
845529
public function getPortraitFile($size)
    {
        $filename = $this->filename;

        //get file extension
        $extension = explode('.', $filename);
        $extension = array_pop($extension);

        //remove extension
        $name = preg_replace('#\.[^.]*$#', '', $filename);

        $filename = $name.'_'.$size.'.'.$extension;

        return $filename;
    }
862397
public function getWebPath(File $file, $size = null)
	{
		if ( ! $file instanceof File) {
			throw new Exception\RuntimeException('File or folder entity expected');
		}

		if ($file instanceof Image && isset($size)) {
			if ( ! $size instanceof ImageSize) {
				$size = $file->findImageSize($size);
			}
		} else {
			$size = null;
		}

		if ($file->isPublic()) {

			$path = $file->getPathEntity()->getWebPath();

			$pathParts = explode('/', $path);
			
			$fileName = array_pop($pathParts);

			// Get file storage url base in webroot
			$path = '/' . trim(implode('/', $pathParts), '/\\') . '/';
			if ($size instanceof ImageSize) {
				$path .= self::RESERVED_DIR_SIZE . '/'
						. rawurlencode($size->getFolderName()) . '/';
			}

			return $path . $fileName;
		}

		return null;
	}
336690
public function getAvatarURL($actor, $size = 'square')
    {
        if ($actor->hasPortrait()) {
            return $actor->getPortraitURL($size);
        }

        return $this->getService('com:base.template.asset')
                    ->getURL('lib_anahita/images/avatar/'.$size.'_default.gif');
    }
891739
public String blogAvatar(String blogName, Integer size) {
        String pathExt = size == null ? "" : "/" + size.toString();
        return requestBuilder.getRedirectUrl(JumblrClient.blogPath(blogName, "/avatar" + pathExt));
    }
919195
public function getAvatar($size = self::AVATAR_SIZE_DEFAULT)
    {
        $avatar = $this->getImage(self::KEY_AVATAR, $size, $size);
        if (empty($avatar)) {
            return static::getUrlAvatar($size);
        }
        return $avatar;
    }
346518
public function url($default = null): ?string
    {
        $disk = $this->getAttribute('disk');

        if (Storage::disk($disk)->exists($this->physicalPath())) {
            return Storage::disk($disk)->url($this->physicalPath());
        }

        return $default;
    }
559770
public function large($email, $default = null, $rating = null)
    {
        return $this->__invoke($email, $this->largeSize, $default, $rating);
    }
665200
public function getAdminThumbAttribute($width = 40, $height = 40)
    {

        // Check if there are images for the model
        if (!method_exists($this, 'images')) {
            return;
        }

        $images = $this->images;
        if ($images->isEmpty()) {
            return;
        }

        // Get null-named (default) images first
        return $images->sortBy('name')->first()->crop($width, $height)->url;
    }
344748
def get_gravatar(email, size=80, rating='g', default=None,
                 protocol=PROTOCOL):
    
    gravatar_protocols = {'http': 'http://www',
                          'https': 'https://secure'}
    url = '%s.gravatar.com/avatar/%s' % (
        gravatar_protocols[protocol],
        md5(email.strip().lower().encode('utf-8')).hexdigest())
    options = {'s': size, 'r': rating}
    if default:
        options['d'] = default

    url = '%s?%s' % (url, urlencode(options))
    return url.replace('&', '&amp;')
861823
public function rating($value, $rating) {
		if (strpos($value, $this->baseUrl) === false && strpos($value, $this->httpsUrl) === false) {
			throw new InvalidArgumentException("You can only add a rating to an existing Gravatar URL");
		}
		else if (!in_array(strtolower($rating), $this->ratings)) {
			throw new InvalidArgumentException("Rating must be g,pg,r or x");
		}
		else {
			return $this->query($value, array("rating" => $rating));
		}
	}
400413
public function generateImageUrl($file, $size=null)
	{
		$url = $this->config->get('prefix').'/'.$file;

		if (!is_null($size)) {
			$url .= '?size='.$size;
		}

		return URL::to($url);
	}
946552
protected function getAvatar(Type $type, int $size)
    {
        if (!is_int($size) || $size < 1) {
            throw new \Exception('Illegal avatar size');
        }

        switch (true) {
            case ($type instanceof GroupType):
                $id = $type->id;
                $resource = 'group';
                break;
            case ($type instanceof AccountType):
                $id = $type->email;
                $resource = 'user';
                break;
            default:
                throw new \Exception('Unsupported type to retrieve avatar information for.');
        }

        $response = $this->client->get(
            $this->client->getConfig('base_uri') . '/avatars/' . $resource . '/' . $id . '/resized/' . $size . '/'
        );

        $json = json_decode($response->getBody());

        return (new AvatarType)->fromJson($json);
    }
847538
public function getAvatar($uid, $size = 'big', $type = 'virtual')
    {
        $size = in_array(strtolower($size), ['big', 'middle', 'small']) ? strtolower($size) : 'big';
        $type = in_array(strtolower($type), ['real', 'virtual']) ? strtolower($type) : 'virtual';
        return $this->config['api'] . sprintf("/avatar.php?uid=%d&type=%ss&size=%s", $uid, $type, $size);
    }
419323
public function avatar($width = null, $height = null,  $returnGravatarIfNotFound = false)
    {
        if($this->profileimage) {
            if(!$width && !$height) {
                return url($this->profileimage->url);
            }else{
                return $this->profileimage->thumb($width, $height, $this->profileimage);
            }
        }

        if($returnGravatarIfNotFound && $this->gravatar) {
            return $this->gravatar;
        }

        return;
    }
312722
private static function getSrcSetUrlCustom($size, $custom, $setWidthInUrl, UriInterface $uri)
    {
        // if custom is eg '2x', add options-dpr-
        if (preg_match('#^([0-9]+)x$#', $custom, $matches)) {
            $uri = self::addOptionsToUri($uri, 'options-dpr-'.$matches[1].
                ($setWidthInUrl ? '--resize-width-'.(int) ceil($size / $matches[1]) : ''));
        } else {
            $stack = new StackUri();
            $stack->addOverridingOptions($custom);
            // if dpr is given in custom option, but not width, calculate correct width
            $resizeOperations = $stack->getStackOperationsByName('resize');
            $widthIsNotSet = true;
            foreach ($resizeOperations as $resizeOperation) {
                if (isset($resizeOperation->options['width'])) {
                    $widthIsNotSet = false;
                }
            }
            $options = $stack->getStackOptions();
            if (isset($options['dpr']) && $widthIsNotSet && $setWidthInUrl) {
                $custom .= '--resize-width-'.(int) ceil($size / $options['dpr']);
            }

            $uri = self::addOptionsToUri($uri, $custom);
        }

        return $uri;
    }