Esempio n. 1
0
        private void GenerateThumbnail(ThumbnailEntity thumEntity)
        {
            string thumFileName = GetImageName(thumEntity.Ext);
            //TODO:如果指定縮略圖的存放地址,按指定的位置存放
            string thumFileFullPath = GetFileFullPath(basicImageDir, thumFileName); //保存路徑,與原圖一樣
            var    thum             = new Thumbnail(thumEntity, basicImageFullPath, thumFileFullPath);

            thum.GenerateThumbnailImage();

            thumEntity.ResourceName = thumFileName;
            var    tempDir           = Path.Combine(imageParam.UploadDir, thumFileName);
            string globalImageDomain = CommonHelper.GlobalResourceDomain;//圖片服務器地址

            thumEntity.ResourceUrl = string.Format("/Upload/{0}", tempDir).FixUrl(globalImageDomain);
        }
Esempio n. 2
0
 /// <summary>
 /// 縮略圖
 /// <param name="param">相關參數</param>
 /// <param name="sPath">原圖路徑</param>
 /// <param name="tPath">縮略圖路徑</param>
 /// </summary>
 public Thumbnail(ThumbnailEntity param, string sPath, string tPath)
 {
     thumEntity         = param;
     sourceImagePath    = sPath;
     thumbnailImagePath = tPath;
 }