private string GetSizedPhotoAbsoluteWebPath(Guid userID, Size size, out bool isdef) { var res = SearchInCache(userID, size, out isdef); if (!string.IsNullOrEmpty(res)) { return(res); } try { var data = UserManager.GetUserPhoto(userID); if (data == null || data.Length == 0) { //empty photo. cache default var photoUrl = GetDefaultPhotoAbsoluteWebPath(size); UserPhotoManagerCache.AddToCache(userID, size, "default"); isdef = true; return(photoUrl); } //Enqueue for sizing SizePhoto(userID, data, -1, size); } catch { } isdef = false; return(GetDefaultPhotoAbsoluteWebPath(size)); }
public string GetPhotoAbsoluteWebPath(Guid userID) { var path = SearchInCache(userID, Size.Empty, out _); if (!string.IsNullOrEmpty(path)) { return(path); } try { var data = UserManager.GetUserPhoto(userID); string photoUrl; string fileName; if (data == null || data.Length == 0) { photoUrl = GetDefaultPhotoAbsoluteWebPath(); fileName = "default"; } else { photoUrl = SaveOrUpdatePhoto(userID, data, -1, new Size(-1, -1), false, out fileName); } UserPhotoManagerCache.AddToCache(userID, Size.Empty, fileName); return(photoUrl); } catch { } return(GetDefaultPhotoAbsoluteWebPath()); }