twaddington / django-gravatar

Essential Gravatar support for Django. Features helper methods, templatetags and a full test suite!
MIT License
151 stars 33 forks source link

Load images with double size for highres screens #19

Closed seocam closed 9 years ago

seocam commented 9 years ago

In order to get an image with quality for highres screens (like 2k, 4k or retina) you have to load the image with double size and display it in actual size. That could be a setting.

For example: when using {% gravatar user.email 100 %} you would have to load the gravatar image with 200 and than set width and height to 100 on the HTML or CSS.

twaddington commented 9 years ago

Hey @seocam, for more complex use cases I'd recommend just leveraging the {% gravatar_url user.email 150 %} tag and building your html manually in the template. For example:

<img src="{% gravatar_url user.email 150 %}" width="300" height="300" alt="{{ user.email }}" />

Adding too many unnamed arguments to a template tag starts to get pretty unruly.

seocam commented 9 years ago

@twaddington that's true...

What about just one settings like GRAVATAR_USE_HIGHRES?

Currently I've implemented with your suggestion. My point is that highres screens are out there and make it easy to most people to implement it right would be great.

twaddington commented 9 years ago

@seocam I understand. Unfortunately supporting high density screens is not as simple as adding one setting. It's impossible to predict how any individual website will desire to display their high density images. For example, they may not even use the img tag at all.

If someone can come up with a concrete recommendation to improve this support I'll consider it but until then I'd rather leave this up to individual website maintainers to figure out.