Click here to Skip to main content
Rate this: bad
good
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))
                    {
                        generator.AddImage(image);
                    }
                }
            }
            using (var outStream = new System.IO.MemoryStream())
            {
                generator.WritePngToStream(outStream);
                // 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 ASP.net 3.5.
 
how to generate,create,save the outstream as an image
Posted 6-Jan-13 8:52am
Ali_1001.3K
Edited 6-Jan-13 10:50am
v2

1 solution

Rate this: bad
good
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.
  Permalink  
Comments
Ali_100 at 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 at 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 at 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 at 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 http://www.codeproject.com/Articles/16120/Thumbnailer-HTTP-Handler 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
0 OriginalGriff 195
1 ProgramFOX 130
2 Maciej Los 105
3 Afzaal Ahmad Zeeshan 82
4 Sergey Alexandrovich Kryukov 75
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2014
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