Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Image can't hold an image?

Reply
Thread Tools

Image can't hold an image?

 
 
Gary B
Guest
Posts: n/a
 
      07-31-2003
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


 
Reply With Quote
 
 
 
 
Steve C. Orr, MCSD
Guest
Posts: n/a
 
      07-31-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Gary B
Guest
Posts: n/a
 
      07-31-2003
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" <(E-Mail Removed)> wrote in message
news:e$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Steve C. Orr, MCSD
Guest
Posts: n/a
 
      08-01-2003
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:e$(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > 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
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Think this film will still hold an image? John A. Digital Photography 6 12-07-2010 07:39 AM
Firefox 1.1 put on hold Posco Firefox 0 02-02-2005 01:45 PM
Can't hold a connection? =?Utf-8?B?U2NyZWFtZXI=?= Wireless Networking 1 12-31-2004 02:21 AM
geting hold of image??? riki Javascript 4 02-06-2004 01:53 PM
Hold Time Check Using a Procedure Anand P Paralkar VHDL 2 09-25-2003 12:13 PM



Advertisments