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. how to convert system.Drawing.Image to system.web.ui.webcontrols.image

how to convert system.Drawing.Image to system.web.ui.webcontrols.image

Scheduled Pinned Locked Moved ASP.NET
databasegraphicsdesignsysadmindata-structures
5 Posts 2 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
    A k ch
    wrote on last edited by
    #1

    Is there a way to convert an System.Drawing.Image to an System.Web.UI.WebControls.Image? Im getting the image from database, the binary being in base 64 string. I then convert it back to an array of bytes. My problem is that I can't find a way to create the System.Web.UI.WebControls.Image with a Stream or an array of bytes... I got the Image from Drawing but I can't convert it back to a WebControl Image. I suppose I must write down the file somewhere on the server then return the path but I dont want to leave these temporary images on the drive. Any ideas or suggestion anyone?

    Thanks & Regards, Anil Chelasani

    C 1 Reply Last reply
    0
    • A A k ch

      Is there a way to convert an System.Drawing.Image to an System.Web.UI.WebControls.Image? Im getting the image from database, the binary being in base 64 string. I then convert it back to an array of bytes. My problem is that I can't find a way to create the System.Web.UI.WebControls.Image with a Stream or an array of bytes... I got the Image from Drawing but I can't convert it back to a WebControl Image. I suppose I must write down the file somewhere on the server then return the path but I dont want to leave these temporary images on the drive. Any ideas or suggestion anyone?

      Thanks & Regards, Anil Chelasani

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      anil.chelasani wrote:

      Is there a way to convert an System.Drawing.Image to an System.Web.UI.WebControls.Image?

      No. The namespace is the clue. One is an image, and one is a control that shows an image. You need to write a page that returns the stream of bytes, and point an Image control to it.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      A 1 Reply Last reply
      0
      • C Christian Graus

        anil.chelasani wrote:

        Is there a way to convert an System.Drawing.Image to an System.Web.UI.WebControls.Image?

        No. The namespace is the clue. One is an image, and one is a control that shows an image. You need to write a page that returns the stream of bytes, and point an Image control to it.

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

        A Offline
        A Offline
        A k ch
        wrote on last edited by
        #3

        Thanks for reply. but the problem is i am converting aspx page to pdf by using third party DLL. Here when i give an aspx URL it will execute that and create a PDF file, but it is not executing the link which is given to ImageURL of the image which resides on the aspx page. Please help me.

        Thanks & Regards, Anil Chelasani

        C 1 Reply Last reply
        0
        • A A k ch

          Thanks for reply. but the problem is i am converting aspx page to pdf by using third party DLL. Here when i give an aspx URL it will execute that and create a PDF file, but it is not executing the link which is given to ImageURL of the image which resides on the aspx page. Please help me.

          Thanks & Regards, Anil Chelasani

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Your page should just contain the image, if you've done it right. No third party tool should change that, unless it flat out does not support images.

          Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

          A 1 Reply Last reply
          0
          • C Christian Graus

            Your page should just contain the image, if you've done it right. No third party tool should change that, unless it flat out does not support images.

            Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

            A Offline
            A Offline
            A k ch
            wrote on last edited by
            #5

            I have a page (supplier.aspx) which will dispaly the anual report of the suppplier on which i have to show the Logo of that supplier. Logo is in Database so first i have to get that to a page(Logo.aspx) i am doing so it is working properly on the aspx by writing the following line of code in the supplier.aspx.cs.

            image.ImageURL="Logo.aspx?supid=4";

            Upto supplier.aspx page it is ok it is displaying the logo but when i conert supplier.aspx page to PDF using

            pdfConverter.SavePdfFromHtmlStringToFile(pdfData, "a.pdf");

            here "pdfData" is html rendered code of the supplier.aspx page. Here is our problem when it converts into PDf it is not displaying the image because it can't execute the path which we had given to ImageURL. It is executing the physical path on the disk and getting the image to pdf from disk but it is not working with aspx page link. So i just want to put directly the image on to the supplier.aspx page without calling Logo.aspx page.

            Thanks & Regards, Anil Chelasani

            modified on Friday, May 29, 2009 3:15 AM

            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