示例#1
0
 private static void saveFile(string filenamepart1, ImageSizeType ist, Image imsmall)
 {
     MemoryStream imagestream = new MemoryStream();
     imsmall.Save(imagestream, System.Drawing.Imaging.ImageFormat.Jpeg);
     CBB.MongoDB.GridFSHelper.UploadFile(imagestream, filenamepart1 + ist.extname + ".jpg");
     imsmall.Dispose();
     imagestream.Dispose();
 }
示例#2
0
 public void AddImageToGridFS(String filename,Stream file,ImageSizeType[] imagesizes)
 {
     Image im = Image.FromStream(file);
     string filenamepart1 = filename.Substring(0,filename.LastIndexOf('.'));
     foreach (ImageSizeType ist in imagesizes)
     {
         Image imsmall = CBB.ImageHelper.ImageSizeHelper.MakeThumbnail(ist.width, ist.height, ist.type, im,ist.watermark);
         saveFile(filenamepart1, ist, imsmall);
     }
 }