If you add d = 404 to the url, gravatar will return the status 404 instead of the default image if the user does not have a set of images.
i.e. http://www.gravatar.com/avatar/098f6bcd4621d373cade4e832627b4f6?s=80&d=404 (user image is not available)
Will return 404.
While
http://www.gravatar.com/avatar/c9ef50b85bd345ea4e0d8da558816f3d?s=80&d=404 ( )
.
, , img.gravatar-img, src, d = 404, , (: HEAD) src,
404, , src , i.e
<img src="" data-defaultImg="">
- src , , , gravatar , , " " JS ajax .
$("img.gravatar-img").each(function(i,el) {
imgUrl = $(el).attr("src") + "&d=404";
$.ajax({
url:imgUrl,
type:"HEAD",
crossDomain:true,
error:function(){
$(el).attr("src", $(el).attr("data-defaultimg"));
}
});
});