i am not getting the list of image, instead i am geting system.image like
According to your description, I am not clear that what your real needs are. Where the function getimage_folder() you use at, and for what? Are you implementing an API to present a list of pictures, and want to know how to handle with System.Draw.Image class?
It is easily to give you more effective solution If you could describe your needs clearly.
Look forward to your reply.
Best Regards,
Abraham
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
4 Points
66 Posts
what is return type for displaying the list of image in C#
Jun 11, 2018 06:11 AM|sidu|LINK
Hi all
below the web api code
public List<System.Drawing.Image> getimage_folder()
{
System.Drawing.Image img=null;
string[] filePaths = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/images"));
List<System.Drawing.Image> imgfile = new List<System.Drawing.Image>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
// files.Add(new ListItem(fileName, "~/Images/" + fileName));
// img.Save(filePath);
// Bitmap image1 = (Bitmap)System.Drawing.Image.FromFile(filePath, true);
System.Drawing.Image image1 = (System.Drawing.Image)System.Drawing.Image.FromFile(filePath, true);
imgfile.Add(image1);
}
return imgfile;
}
i am not getting the list of image, instead i am geting system.image like
what is return type for geting the image
Member
740 Points
321 Posts
Re: what is return type for displaying the list of image in C#
Jun 12, 2018 09:43 AM|Abraham Qian|LINK
Hi Sidu,
According to your description, I am not clear that what your real needs are. Where the function getimage_folder() you use at, and for what? Are you implementing an API to present a list of pictures, and want to know how to handle with System.Draw.Image class?
It is easily to give you more effective solution If you could describe your needs clearly.
Look forward to your reply.
Best Regards,
Abraham