Ejemplo n.º 1
0
        //public static string GetItemThumbUrl(Guid storeKey)
        //{
        //    if (string.IsNullOrEmpty(fileKey)) return string.Empty;

        //    if (IsImage(fileKey))
        //    {
        //        return GetDynamicUrl(fileKey, 122, 91, 2);
        //    }
        //    // 其他类型的文件
        //    else
        //    {
        //        return GetDynamicUrl(fileKey, 122, 91, 2);
        //    }
        //}

        //public static string GetItemUrl(string fileKey)
        //{
        //    if (string.IsNullOrEmpty(fileKey)) return string.Empty;

        //    if (IsImage(fileKey))
        //    {
        //        return GetDynamicUrl(fileKey, 0, 0);
        //    }
        //    // 其他类型的文件
        //    else
        //    {
        //        return GetFileUrl(fileKey);
        //    }
        //}

        //public static bool IsImage(string fileKey)
        //{
        //    var ext = Path.GetExtension(fileKey).Trim('.');
        //    return _images.Contains(ext);
        //}

        ///// <summary>
        ///// 获取默认图片
        ///// </summary>
        ///// <param name="width"></param>
        ///// <param name="height"></param>
        ///// <param name="cutType"></param>
        ///// <returns></returns>
        //public static string GetDefaultUrl(int width = 122, int height = 91)
        //{
        //    return GetDynamicUrl(string.Empty, width, height);
        //}


        //public static string GetUserPhoto(Guid fileId, int width, int height, int cutType = 2)
        //{
        //    if (fileId == Guid.Empty) return string.Empty;

        //    var result = ServiceContext.Invoke("getFile", (arg) => {
        //        arg["fileId"] = fileId;
        //    });

        //    var key = result.GetValue<string>("fileKey", string.Empty);

        //    if (string.IsNullOrEmpty(key)) return string.Empty;
        //    else
        //    {
        //        return GetUrl("file", string.Format("/image-{0}-{1}-{2}-{3}", width, height, cutType, key));
        //    }
        //}


        public static string GetUrl(string domainKey, string path)
        {
            var domain = GetDomain(domainKey);

            return(WebUtil.Combine(domain, path));
        }