In the context of having a list of user that has an icon next to their name, is it better to cache all images of Gravatar for few minutes or it's fine to directly display the image from Gravatar? The list is around 200 users on every pages.
Let Gravatar do the caching. Most likely the a local isp, if not browser, would have them cached further downstream already.
Not sure how you were going to hold them on your server, but it's better web performance to load from multiple domains anyway, allows more parallel downloads.
In fact, if you cached them yourself you might do a lot more damage than good, as it's more likely someone is going to have the popular gravatars cached from a visit to some other site, SO for e.g.
The avatars are already cached in the browser cache so don't try to implement your own caching mechanism. But is it really necessary to display 200 avatar images on each page?
Linking to them will be simpler and it will allow Gravatar to figure out how the caching should work. (e.g.: how long the browser cache should be?)
I think it is important to have a local cache of Gravatars in your Web application for privacy and data protection reasons. Especially if you are under Web site is under strict data protection laws like in germany, but also if you honor the privacy if your vistors
If you directly embed the Gravatars each image load will be logged at wordpress.com with the ip address of the visitor as well as the pages visited (referer). This allows wordpress.com to collect visits accross multiple sites and allows profiling. This is similiar to the problem you know with social buttons (where a "two click" solution also helps to not send tracking referrers to those networks).
You just need to keep in mind, that it is better to load those images from a different host (in the URL) to allow the browser to connect with more parallel connections to speed up load times (and you need to handle cache refresh, invalidation and defend injection.)
Some software (for example the Serpendipity Blog platform) offers caching plug-ins so you dont have to handle that yourself.
(And yes I am aware, this will slow down your users as they have to download (and browser cache) the same gravatar multiple times as the URLs differ). So it is a trade off between efficiency and privacy.
© 2022 - 2024 — McMap. All rights reserved.