Ejemplo n.º 1
0
        private static string GetGoodsImageFilePath(DateTime now, string fileName, GoodsImageSize size)
        {
            var savePath = string.Format("/Upload/GoodsImage/{0}/{1}"
                                         , now.ToString("yyyyMM")
                                         , now.ToString("yyyyMMddHHmmssfff") + "_" + size.ToString() + Utils.GetFileExtName(fileName));
            var dir = Path.GetDirectoryName(HttpContext.Current.Server.MapPath(savePath));

            if (dir != null && !Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            return(savePath);
        }
Ejemplo n.º 2
0
 public static string GetGoodsImageUrl(string fileName, GoodsImageSize size)
 {
     return(fileName.Replace(Utils.GetFileExtName(fileName), string.Empty) + "_" + size.ToString() +
            Utils.GetFileExtName(fileName));
 }