diplaying image RRS feed

  • Question

  • User-2142732811 posted
    when you genrerate an image on the fly like chart how do you insert it in your page ? with object, iframe, ... ? not to get the image alone in an horrible white page but to include it at a definite place in your normal page (keeping header m footer, menu , ..) with such a code >>> Dim bmp As Bitmap Dim memStream As New System.IO.MemoryStream bmp = _myChart.GetBitmap() bmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png) HttpContext.Current.Response.ContentType = "image/png" memStream.WriteTo(HttpContext.Current.Response.OutputStream) HttpContext.Current.Response.End()
    Friday, April 16, 2004 1:46 PM

All replies

  • User-46888941 posted
    I always uses an image control to insert them. The images are in separate files.
    Sunday, April 18, 2004 3:56 AM
  • User-2142732811 posted
    Even for a temporary image ? ..... not on the disk ? ..... I try ! thank you
    Sunday, April 18, 2004 4:59 AM
  • User-865881720 posted
    There is only one (well, maybe two) ways to place an image into the HTML stream - and that is with the usual IMG tag. The Src attribute must either reference an image file OR an ASPX page that streams dynamic content. While you could first save the created image to a file (and often times will want to if the image will be viewed by many users), you would need to save the file into a directory with the proper write permissions. Many web hosts do not permit this within the web space. For charts generated on the fly, I think it makes better sense to simply stream the image via the Response.OutputStream. See other posts in the GDI+ forum for examples.
    Sunday, April 18, 2004 8:43 PM
  • User-2142732811 posted
    then I must change my method because with img tag it doesn't work , I must use an iframe for chart I have not to keep the image on the disk thank you
    Monday, April 19, 2004 12:47 AM