public ThumbnailsDataWrapper(Guid userId, UserPhotoManager userPhotoManager) { Original = userPhotoManager.GetPhotoAbsoluteWebPath(userId); Retina = userPhotoManager.GetRetinaPhotoURL(userId); Max = userPhotoManager.GetMaxPhotoURL(userId); Big = userPhotoManager.GetBigPhotoURL(userId); Medium = userPhotoManager.GetMediumPhotoURL(userId); Small = userPhotoManager.GetSmallPhotoURL(userId); }
public ThumbnailsDataWrapper(Tenant tenant, Guid userId) { Original = UserPhotoManager.GetPhotoAbsoluteWebPath(tenant, userId); Retina = UserPhotoManager.GetRetinaPhotoURL(tenant.TenantId, userId); Max = UserPhotoManager.GetMaxPhotoURL(tenant.TenantId, userId); Big = UserPhotoManager.GetBigPhotoURL(tenant.TenantId, userId); Medium = UserPhotoManager.GetMediumPhotoURL(tenant.TenantId, userId); Small = UserPhotoManager.GetSmallPhotoURL(tenant.TenantId, userId); }
public static string GetRetinaPhotoURL(this UserInfo userInfo) { return(UserPhotoManager.GetRetinaPhotoURL(userInfo.ID)); }
public FileUploadResult ProcessUpload(HttpContext context) { var result = new FileUploadResult(); try { if (context.Request.Files.Count != 0) { Guid userId; try { userId = new Guid(context.Request["userId"]); } catch { userId = SecurityContext.CurrentAccount.ID; } SecurityContext.DemandPermissions(new UserSecurityProvider(userId), Constants.Action_EditUser); var userPhoto = context.Request.Files[0]; if (userPhoto.InputStream.Length > SetupInfo.MaxImageUploadSize) { result.Success = false; result.Message = FileSizeComment.FileImageSizeExceptionString; return(result); } var data = new byte[userPhoto.InputStream.Length]; var br = new BinaryReader(userPhoto.InputStream); br.Read(data, 0, (int)userPhoto.InputStream.Length); br.Close(); CheckImgFormat(data); if (context.Request["autosave"] == "true") { if (data.Length > SetupInfo.MaxImageUploadSize) { throw new ImageSizeLimitException(); } var mainPhoto = UserPhotoManager.SaveOrUpdatePhoto(userId, data); result.Data = new { main = mainPhoto, retina = UserPhotoManager.GetRetinaPhotoURL(userId), max = UserPhotoManager.GetMaxPhotoURL(userId), big = UserPhotoManager.GetBigPhotoURL(userId), medium = UserPhotoManager.GetMediumPhotoURL(userId), small = UserPhotoManager.GetSmallPhotoURL(userId), }; } else { result.Data = UserPhotoManager.SaveTempPhoto(data, SetupInfo.MaxImageUploadSize, UserPhotoManager.OriginalFotoSize.Width, UserPhotoManager.OriginalFotoSize.Height); } result.Success = true; } else { result.Success = false; result.Message = PeopleResource.ErrorEmptyUploadFileSelected; } } catch (UnknownImageFormatException) { result.Success = false; result.Message = PeopleResource.ErrorUnknownFileImageType; } catch (ImageWeightLimitException) { result.Success = false; result.Message = PeopleResource.ErrorImageWeightLimit; } catch (ImageSizeLimitException) { result.Success = false; result.Message = PeopleResource.ErrorImageSizetLimit; } catch (Exception ex) { result.Success = false; result.Message = ex.Message.HtmlEncode(); } return(result); }
public static string GetRetinaPhotoURL(this UserInfo userInfo, int tenantId) { return(UserPhotoManager.GetRetinaPhotoURL(tenantId, userInfo.ID)); }