public override ImagePreviewDTO SaveAspect(HttpPostedFile file) { ImagePreviewDTO previewDTO = base.SaveAspect(file); string Folder_60X60 = string.Format("{0}\\60X60", this.FolderServerPath); string Folder_120X120 = string.Format("{0}\\120X120", this.FolderServerPath); if (!System.IO.Directory.Exists(Folder_60X60)) { System.IO.Directory.CreateDirectory(Folder_60X60); } if (!System.IO.Directory.Exists(Folder_120X120)) { System.IO.Directory.CreateDirectory(Folder_120X120); } string fileName_60X60 = string.Format(Folder_60X60 + "\\{0}", previewDTO.FileName); string fileName_120X120 = string.Format(Folder_120X120 + "\\{0}", previewDTO.FileName); string orignalFilePath = string.Format(this.OrignalImageServerPath + "\\{0}", previewDTO.FileName); //自己需要使用的尺寸 IWEHAVE.ERP.GAIA.WEBUtil.FileManage.MakeThumbnail(orignalFilePath, fileName_60X60, 60, 60, "AHW"); IWEHAVE.ERP.GAIA.WEBUtil.FileManage.MakeThumbnail(orignalFilePath, fileName_120X120, 120, 120, "AHW"); BrandImagePreviewDTO brandPreviewDTO = new BrandImagePreviewDTO(previewDTO); brandPreviewDTO.Image_60X60 = string.Format("{0}/60X60/{1}", this.FolderPath, previewDTO.FileName); brandPreviewDTO.Image_120X120 = string.Format("{0}/120X120/{1}", this.FolderPath, previewDTO.FileName); return brandPreviewDTO; }
public override List<ImagePreviewDTO> LoadAspect() { List<ImagePreviewDTO> imagePreviewDTOList = base.LoadAspect(); for (int i = 0; i < imagePreviewDTOList.Count; i++) { ImagePreviewDTO imagePreviewDTO = imagePreviewDTOList[i]; BrandImagePreviewDTO brandPreviewDTO = new BrandImagePreviewDTO(imagePreviewDTO); brandPreviewDTO.Image_60X60 = string.Format("{0}/60X60/{1}", this.FolderPath, brandPreviewDTO.FileName); imagePreviewDTOList[i] = brandPreviewDTO; } return imagePreviewDTOList; }