如何在同一文件夹中保存多个图像? [英] How do I save multiple images in a same folder?
本文介绍了如何在同一文件夹中保存多个图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用c#在上传时获取图片的缩略图并将其保存在特定文件夹中。我已经给出了一个路径名来保存它。我需要知道如何在不使用对话框的情况下保存它。
我尝试了什么:
if(image!= null)
{
imgThumb = image.GetThumbnailImage(100,100,null,new IntPtr());
this.Refresh();
imgThumb.Save(C:\\Users \\Acer \\Pictures\\Camera Roll \\\umbumb2.jpg);
MessageBox.Show(Image Saved Successfully);
}
解决方案
imgThumb.Save(C: \\Users\\Acer \\Pictures\\Camera Roll \\\\umbumbnail2.jpg; $
也许您需要更改Thumbnail2.jpg。
您可以节省相同的文件。
string strPictures =缩略图+ 1;
imgThumb.Save(string.Format(@C:\ Users \Acer \ Pictures\Camera Roll \ {0},strPictures));
string strPictures =Thumbnail+ DateTime.Now.ToString(yyyyMMddHHmmss)+.jpg ;
imgThumb.Save(string.Format(@C:\ Users \Acer \ Pictures\Camera Roll \ {0},strPictures));
这样你就会有新的图像名称
I'm using c# to get a thumbnail of an image on upload and save it in a specific folder. I've given a path name to save it currently. I need to know how to save it without using a dialog box.
What I have tried:
if (image != null) { imgThumb = image.GetThumbnailImage(100, 100, null, new IntPtr()); this.Refresh(); imgThumb.Save("C:\\Users\\Acer\\Pictures\\Camera Roll\\thumbnail2.jpg"); MessageBox.Show("Image Saved Successfully"); }
解决方案
imgThumb.Save("C:\\Users\\Acer\\Pictures\\Camera Roll\\thumbnail2.jpg");
Maybe you need to change your Thumbnail2.jpg.
you are all time saving on the same file.
string strPictures = "Thumbnail" + 1; imgThumb.Save(string.Format(@"C:\Users\Acer\Pictures\Camera Roll\{0}", strPictures));
string strPictures = "Thumbnail" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg"; imgThumb.Save(string.Format(@"C:\Users\Acer\Pictures\Camera Roll\{0}", strPictures));
This way you will have always new image name
这篇关于如何在同一文件夹中保存多个图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文