ASC.Web.Core.Users.UserPhotoManager.GetDefaultPhotoAbsoluteWebPath(System.Drawing.Size)

Here are the examples of the csharp api class ASC.Web.Core.Users.UserPhotoManager.GetDefaultPhotoAbsoluteWebPath(System.Drawing.Size) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

1. Example

Project: CommunityServer
Source File: UserPhotoManager.cs
public static string GetDefaultSmallPhotoURL()
        {
            return GetDefaultPhotoAbsoluteWebPath(SmallFotoSize);
        }

2. Example

Project: CommunityServer
Source File: UserPhotoManager.cs
public static string GetDefaultMediumPhotoURL()
        {
            return GetDefaultPhotoAbsoluteWebPath(MediumFotoSize);
        }

3. Example

Project: CommunityServer
Source File: UserPhotoManager.cs
private static string SizePhoto(Guid moduleID, Guid userID, byte[] data, long maxFileSize, Size size, bool now)
        {
            if (data == null || data.Length <= 0) throw new UnknownImageFormatException();
            if (maxFileSize != -1 && data.Length > maxFileSize) throw new ImageWeightLimitException();

            var resizeTask = new ResizeWorkerItem(moduleID, userID, data, maxFileSize, size, GetDataStore());
            if (now)
            {
                //Resize synchronously
                ResizeImage(resizeTask);
                return GetSizedPhotoAbsoluteWebPath(moduleID, userID, size);
            }
            else
            {
                if (!ResizeQueue.GetItems().Contains(resizeTask))
                {
                    //Add
                    ResizeQueue.Add(resizeTask);
                    if (!ResizeQueue.IsStarted)
                    {
                        ResizeQueue.Start(ResizeImage);
                    }
                }
                return GetDefaultPhotoAbsoluteWebPath(size);
                //NOTE: return default photo here. Since task will update cache
            }
        }

4. Example

Project: CommunityServer
Source File: UserPhotoManager.cs
public static string GetSizedTempPhotoAbsoluteWebPath(string fileName, int newWidth, int newHeight)
/n ..... /n //View Source file for more details /n }

5. Example

Project: CommunityServer
Source File: UserPhotoManager.cs
private static string GetSizedPhotoAbsoluteWebPath(Guid moduleID, Guid userID, Size size)
        {
            var thumbUrl = TryGetFromThumbnail(userID, size.Width, size.Height);
            if (!string.IsNullOrEmpty(thumbUrl))
                return thumbUrl;


            var res = SearchInCache(moduleID, userID, size);
            if (!string.IsNullOrEmpty(res)) return res;

            try
            {
                var data = CoreContext.UserManager.GetUserPhoto(userID, moduleID);

                if (data == null || data.Length == 0)
                {
                    //empty photo. cache default
                    string photoUrl = GetDefaultPhotoAbsoluteWebPath(size);
                    var fileName = Path.GetFileName(photoUrl);
                    AddToCache(userID, size, fileName);
                    return photoUrl;
                }

                //Enqueue for sizing
                SizePhoto(moduleID, userID, data, -1, size);
            }
            catch { }

            return GetDefaultPhotoAbsoluteWebPath(size);
        }