Image can't hold an image?

Discussion in 'ASP .Net' started by Gary B, Jul 31, 2003.

  1. Gary B

    Gary B Guest

    I'm converting a windows application to a web application. (by the way,
    this is way easier than it used to be - many of the modules went over
    untouched!)

    The windows app used a pictuebox and got an image directly from a sqlserver
    database. Upon examination of the Image web control, it seems the imageURL
    property must come from a file? Is they anyway to directly feed it a vb.net
    image object?
    Thanks,
    Gary
    Gary B, Jul 31, 2003
    #1
    1. Advertising

  2. No, you must use an image tag which links to a file. It doesn't have to be
    a picture file though. You could link it to a ASPX page that dynamically
    outputs the image.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net


    "Gary B" <> wrote in message
    news:...
    > I'm converting a windows application to a web application. (by the way,
    > this is way easier than it used to be - many of the modules went over
    > untouched!)
    >
    > The windows app used a pictuebox and got an image directly from a

    sqlserver
    > database. Upon examination of the Image web control, it seems the

    imageURL
    > property must come from a file? Is they anyway to directly feed it a

    vb.net
    > image object?
    > Thanks,
    > Gary
    >
    >
    Steve C. Orr, MCSD, Jul 31, 2003
    #2
    1. Advertising

  3. Gary B

    Gary B Guest

    Steve,
    I had actually tried something like that earlier with
    environmanet.currentdirectory but I changed my code to read as follows after
    your suggestion:


    FilePath = Server.MapPath("/DBAPhotoQuery")
    FilePath = FilePath & "\currentPic.jpg"


    --> at this point filePath is:
    c:\inetpub\wwwroot\DBAPhotoQuery\currentPic.jpg


    myImage.Save(FilePath, Imaging.ImageFormat.Jpeg)
    DBAPictureBox1.ImageUrl = FilePath

    This also gets a generic GDI + exception.
    but if I insert:
    FilePath = "c:\currentpic.jpg"
    just before the myImage.save then it works!!

    I've checked very carefully and the c:\inetpub.... string is valid. Maybe
    its security related??
    I appreciate the help so far,
    Thanks
    Gary

    "Steve C. Orr, MCSD" <> wrote in message
    news:e$...
    > The code sample you listed may work on your dev box, but it won't once you
    > move it to the server, because you haven't given a real URL.
    > You can use the Server.Mappath method to help with this.
    > Here's more info:
    >

    http://msdn.microsoft.com/library/d...stemWebHttpServerUtilityClassMapPathTopic.asp
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > http://Steve.Orr.net
    >
    >
    > "Gary B" <> wrote in message
    > news:...
    > > Steve:
    > > Well, the following works:
    > > myImage.Save("C:\currentPic.jpg", Imaging.ImageFormat.Jpeg)
    > > ImageCtrl.ImageUrl = "C:\currentpic.jpg"
    > >
    > > But if I try to make it a relative url, such as ".\curentpic.jpg", the

    > .save
    > > gets "a generic GDI + exception. How can I save it to the directory

    where
    > > the web is running?
    > > Thanks,
    > > Gary
    > >
    > >
    > >
    > >
    > > "Steve C. Orr, MCSD" <> wrote in message
    > > news:...
    > > > No, you must use an image tag which links to a file. It doesn't have

    to
    > > be
    > > > a picture file though. You could link it to a ASPX page that

    > dynamically
    > > > outputs the image.
    > > >
    > > > --
    > > > I hope this helps,
    > > > Steve C. Orr, MCSD
    > > > http://Steve.Orr.net
    > > >
    > > >
    > > > "Gary B" <> wrote in message
    > > > news:...
    > > > > I'm converting a windows application to a web application. (by the

    > way,
    > > > > this is way easier than it used to be - many of the modules went

    over
    > > > > untouched!)
    > > > >
    > > > > The windows app used a pictuebox and got an image directly from a
    > > > sqlserver
    > > > > database. Upon examination of the Image web control, it seems the
    > > > imageURL
    > > > > property must come from a file? Is they anyway to directly feed it

    a
    > > > vb.net
    > > > > image object?
    > > > > Thanks,
    > > > > Gary
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Gary B, Aug 1, 2003
    #3
  4. The ASPNET user account must have create/write privileges to whatever folder
    you're trying to save to.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net


    "Gary B" <> wrote in message
    news:%...
    > Steve,
    > I had actually tried something like that earlier with
    > environmanet.currentdirectory but I changed my code to read as follows

    after
    > your suggestion:
    >
    >
    > FilePath = Server.MapPath("/DBAPhotoQuery")
    > FilePath = FilePath & "\currentPic.jpg"
    >
    >
    > --> at this point filePath is:
    > c:\inetpub\wwwroot\DBAPhotoQuery\currentPic.jpg
    >
    >
    > myImage.Save(FilePath, Imaging.ImageFormat.Jpeg)
    > DBAPictureBox1.ImageUrl = FilePath
    >
    > This also gets a generic GDI + exception.
    > but if I insert:
    > FilePath = "c:\currentpic.jpg"
    > just before the myImage.save then it works!!
    >
    > I've checked very carefully and the c:\inetpub.... string is valid. Maybe
    > its security related??
    > I appreciate the help so far,
    > Thanks
    > Gary
    >
    > "Steve C. Orr, MCSD" <> wrote in message
    > news:e$...
    > > The code sample you listed may work on your dev box, but it won't once

    you
    > > move it to the server, because you haven't given a real URL.
    > > You can use the Server.Mappath method to help with this.
    > > Here's more info:
    > >

    >

    http://msdn.microsoft.com/library/d...stemWebHttpServerUtilityClassMapPathTopic.asp
    > >
    > > --
    > > I hope this helps,
    > > Steve C. Orr, MCSD
    > > http://Steve.Orr.net
    > >
    > >
    > > "Gary B" <> wrote in message
    > > news:...
    > > > Steve:
    > > > Well, the following works:
    > > > myImage.Save("C:\currentPic.jpg", Imaging.ImageFormat.Jpeg)
    > > > ImageCtrl.ImageUrl = "C:\currentpic.jpg"
    > > >
    > > > But if I try to make it a relative url, such as ".\curentpic.jpg", the

    > > .save
    > > > gets "a generic GDI + exception. How can I save it to the directory

    > where
    > > > the web is running?
    > > > Thanks,
    > > > Gary
    > > >
    > > >
    > > >
    > > >
    > > > "Steve C. Orr, MCSD" <> wrote in message
    > > > news:...
    > > > > No, you must use an image tag which links to a file. It doesn't

    have
    > to
    > > > be
    > > > > a picture file though. You could link it to a ASPX page that

    > > dynamically
    > > > > outputs the image.
    > > > >
    > > > > --
    > > > > I hope this helps,
    > > > > Steve C. Orr, MCSD
    > > > > http://Steve.Orr.net
    > > > >
    > > > >
    > > > > "Gary B" <> wrote in message
    > > > > news:...
    > > > > > I'm converting a windows application to a web application. (by

    the
    > > way,
    > > > > > this is way easier than it used to be - many of the modules went

    > over
    > > > > > untouched!)
    > > > > >
    > > > > > The windows app used a pictuebox and got an image directly from a
    > > > > sqlserver
    > > > > > database. Upon examination of the Image web control, it seems the
    > > > > imageURL
    > > > > > property must come from a file? Is they anyway to directly feed

    it
    > a
    > > > > vb.net
    > > > > > image object?
    > > > > > Thanks,
    > > > > > Gary
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Steve C. Orr, MCSD, Aug 1, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Y2lhcmFu?=

    InProc Session - How much can it hold?

    =?Utf-8?B?Y2lhcmFu?=, Apr 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,094
    David Browne
    Apr 20, 2004
  2. kbutterly
    Replies:
    2
    Views:
    385
    kbutterly
    Dec 6, 2006
  3. Replies:
    3
    Views:
    362
    Tomás
    May 15, 2006
  4. Replies:
    10
    Views:
    708
    Daniel T.
    Feb 3, 2006
  5. riki

    geting hold of image???

    riki, Feb 6, 2004, in forum: Javascript
    Replies:
    4
    Views:
    100
Loading...

Share This Page