Skip to content

Commit

Permalink
Use "default" and "size" arguments of Gravatar.get_image()
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaboiss committed Apr 11, 2024
1 parent 2c10f96 commit f882515
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions pelican/plugins/avatar/avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,23 @@ def gen_avatar_url(settings, email):
email = email.lower()
# Compose URL
if settings.get("AVATAR_USE_GRAVATAR"):
url = Gravatar(email).get_image()
params = {}
if missing:
params["default"] = missing
if size:
params["size"] = size
url = Gravatar(email).get_image(**params)
else:
url = libravatar_url(email)

# Add eventual "missing picture" option
if missing or size:
url = url + "?"
if missing:
url = url + "d=" + missing
if missing or size:
url = url + "?"
if missing:
url = url + "d=" + missing
if size:
url = url + "&"
if size:
url = url + "&"
if size:
url = url + "s=" + str(size)
url = url + "s=" + str(size)

return url


Expand Down

0 comments on commit f882515

Please sign in to comment.