Click here to Skip to main content
11,922,603 members (31,641 online)
Rate this:
Please Sign up or sign in to vote.
See more: file image generation
public static void ProcessDirectory(string targetDirectory)
       // string[] fileEntries = Directory.GetFiles(targetDirectory, "*.jpg");
       var fileEntries = Directory.GetFiles(targetDirectory, "*.jpg");
       //if (photos.Count() == 0)
       //    Response.Redirect("~/Images/gallery-empty.png");
       //    return;
       // Process the list of files found in the directory.

       using (var generator = new MultiThumbnailGenerator())
           foreach (var photo in fileEntries)
               using (var imageStream = new System.IO.MemoryStream(photo.FileContents)) //error
                   using (var image = System.Drawing.Image.FromStream(imageStream))
           using (var outStream = new System.IO.MemoryStream())
               // var image = new WebImage(outStream);
               //   image.Write();

*MultiThumbnailGenerator is a class where i am generating thumbnail of many images of the folder , in that thumbnail all the images have lightly display,,,

I have an outstream (of many images to develop an image) ,I googled it but my requirement is 3.5.

how to generate,create,save the outstream as an image
Posted 6-Jan-13 8:52am
Edited 6-Jan-13 10:50am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This has not changed in how it works for a long time. I don't see how there could be anything new in ASP.NET 4, I did this in 1.1. You create a HTTP handler and on the URL that handler processes, you pass an id. That id tells you what image to look up in your DB. You write those bytes to the output stream. Your browser uses the URL to access the image, and gets back the bytes of the image.
Ali_100 6-Jan-13 15:51pm
I am sorry christian graus,i dont know how there is mistakenly half pasting in the QUestion,,
well now i updated it,
Christian Graus 6-Jan-13 15:53pm
Why are you using var for types you know ? What is the problem here ? One http request cannot return many images. You can only return one image at a time.
Ali_100 6-Jan-13 16:23pm
I am not much experience ,actually it was a code from webmatrix,which i use in 3.5,, now i am trying to use httphandler,,, ok I am using http handler,, can you give me any example ... or tell me from where should i do that first...
Christian Graus 6-Jan-13 16:25pm
Too many people on this site have 'not much experience' and get by in paid jobs because we do the work for them. It's not a long term strategy for you. Buy some books and try to learn, don't just rely on us.

Also, try to search the site before you ask. I think is exactly what you need.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151125.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100