Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Display Images on Page from Database

Display Images on Page from Database

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AB7771
    wrote on last edited by
    #1

    Hi all, I googled a lot and found that to display images from database we need to fetch it from DB and Convert it to Byte[] and then pass it to Response.BinaryWrite() method. But this is not working for me. Can anyone please help me wid this?

    Thanks & Regards, Pramod "Everyone is a genius at least once a year"

    L A 3 Replies Last reply
    0
    • A AB7771

      Hi all, I googled a lot and found that to display images from database we need to fetch it from DB and Convert it to Byte[] and then pass it to Response.BinaryWrite() method. But this is not working for me. Can anyone please help me wid this?

      Thanks & Regards, Pramod "Everyone is a genius at least once a year"

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      check the link http://www.aspsnippets.com/post/Display-Images-from-Database-using-ASPNet.aspx[^]

      Regards Aman Bhullar www.arlivesupport.com[^]

      1 Reply Last reply
      0
      • A AB7771

        Hi all, I googled a lot and found that to display images from database we need to fetch it from DB and Convert it to Byte[] and then pass it to Response.BinaryWrite() method. But this is not working for me. Can anyone please help me wid this?

        Thanks & Regards, Pramod "Everyone is a genius at least once a year"

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi, U need to take one .aspx page while displaying u have to assign URL to ASP:Image and on that page u have to convert it into byte code. Thanks Amit Patel

        1 Reply Last reply
        0
        • A AB7771

          Hi all, I googled a lot and found that to display images from database we need to fetch it from DB and Convert it to Byte[] and then pass it to Response.BinaryWrite() method. But this is not working for me. Can anyone please help me wid this?

          Thanks & Regards, Pramod "Everyone is a genius at least once a year"

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          You need to create the image from byte array. use a temporary folder to create the image.

          byte[] image = GetImageDataFromDatabase();
          string imagepath = Path.Combine(Path.Combine(Request.PhysicalApplicationPath,"tempImages"), "imagename.jpg");
          using (FileStream ofstream = new FileStream(imagepath, FileMode.Create))
          {
          ofstream.Write(image, 0, image.Length);
          ofstream.Close();
          }
          imgobj.src= "tempImages/imagename.jpg";

          This will work. :rose:

          Abhishek Sur


          My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

          **Don't forget to click "Good Answer" if you like to.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups