How create Image file

Last post 04-17-2009 7:20 AM by shahid13384. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 04-08-2009 9:26 AM

    • shahid13384
    • Top 50 Contributor
    • Joined on 06-09-2008
    • United States of Mehsana
    • Wannabe Slacker
    • Points 563

    How create Image file

    Hi all, In my project i am storing the image in database in binary format.now i need to create image file(.gif/jpeg/bmp) from that binary data and store that file in separate folder.e.g i have data of 20 student and i want to generate 20 image file that contain photo of those student how to do . any idea

     

     

    Thanks & Regards


    The trouble with the world is that the stupid are sure and the intelligent are full of doubt.

    Shahid Hussain Shaikh
    Filed under: , ,
  •  Advertisement

    Featured Advertisement

     
  • 04-08-2009 9:30 AM In reply to

    Re: How create Image file

    check out this tutorial code > Using ASHX files to retrieve DB images

    also one nice article on Should I store images in the database or the filesystem? if you want to refer

    hope it helps./.

    "I would love to change the world, but they won’t give me the source code"

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point & mark your thread as Resolved for the sake of Future Readers.

    KaushaL || BLOG || Profile || Microsoft MVP
  • 04-10-2009 7:40 AM In reply to

    • shahid13384
    • Top 50 Contributor
    • Joined on 06-09-2008
    • United States of Mehsana
    • Wannabe Slacker
    • Points 563

    Re: How create Image file

    thanks but ,it did not solve my problem

    Thanks & Regards


    The trouble with the world is that the stupid are sure and the intelligent are full of doubt.

    Shahid Hussain Shaikh
  • 04-10-2009 10:41 AM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: How create Image file

     i wonder why it does not solve your problem. It should. Please specify. I will be happy to check it out for you

  • 04-17-2009 1:07 AM In reply to

    Re: How create Image file

    shahid13384:
    it did not solve my problem

    receiving any error??

    or

    not able to figure out??

    or

    problem in resolving the links which i gave you??

    can you provide details on. thanx./.

    "I would love to change the world, but they won’t give me the source code"

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point & mark your thread as Resolved for the sake of Future Readers.

    KaushaL || BLOG || Profile || Microsoft MVP
  • 04-17-2009 7:20 AM In reply to

    • shahid13384
    • Top 50 Contributor
    • Joined on 06-09-2008
    • United States of Mehsana
    • Wannabe Slacker
    • Points 563

    Re: How create Image file

    Hi m pasting my code bellow

     DataSet ds= getImageData(ConfigurationSettings.AppSettings["DBProvider"].ToString(),strTableName,strColumnName,strSysId);
                    if (ds != null)
                    {
                        byte[ byteArray = (byte[)ds.Tables[0].Rows[0][0];
                        Stream streamImageStream = new MemoryStream(byteArray);

                       Response.ContentType="image/jpeg";
                        Response.BinaryWrite(ShowOriginalImage(streamImageStream));//To Display Original Image
                    }

     

     protected  byte[ ShowOriginalImage(Stream ImageStream)
        {
          System.Drawing.Image  g = System.Drawing.Image.FromStream(ImageStream);
            Bitmap imgOutput = new Bitmap(g);
            MemoryStream imgStream = new MemoryStream();
            imgOutput.Save(imgStream, g.RawFormat);
            byte[ imgbin = new byte[imgStream.Length + 1];
            imgStream.Position = 0;
            Int32 n = imgStream.Read(imgbin, 0, imgbin.Length);
            g.Dispose();
            imgOutput.Dispose();
            return imgbin;
        }

    but don't where is the problem

    Thanks & Regards


    The trouble with the world is that the stupid are sure and the intelligent are full of doubt.

    Shahid Hussain Shaikh
Page 1 of 1 (6 items)