470,632 Members | 2,176 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,632 developers. It's quick & easy.

Image can't hold an image?

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
Nov 17 '05 #1
3 1657
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" <de*********@earthlink.net> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #2
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" <St***@Orr.net> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
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/de...pPathTopic.asp
--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Gary B" <de*********@earthlink.net> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl...
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" <St***@Orr.net> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
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" <de*********@earthlink.net> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
> 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
>
>



Nov 17 '05 #3
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" <de*********@earthlink.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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" <St***@Orr.net> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
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/de...pPathTopic.asp

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Gary B" <de*********@earthlink.net> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl...
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" <St***@Orr.net> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
> 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" <de*********@earthlink.net> wrote in message
> news:OB**************@TK2MSFTNGP10.phx.gbl...
> > 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
> >
> >
>
>



Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by ywg | last post: by
4 posts views Thread by riki | last post: by
1 post views Thread by D. Yates | last post: by
2 posts views Thread by Noozer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.