Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#248912 - 10/02/2005 18:50 Question: Web page images
Folsom
member

Registered: 12/08/2001
Posts: 175
Loc: Atlanta
I have a Dlink internet camera, and I would like to publish a static image from the camera on my website. I would prefer not to open a new port to access the image. Is there an easy way to publish the picture using a server script? I was thinking the server script could grab the image and then send it out.

My server is running IIS, so I tried playing around with asp files. I started with a windows function called URLDownloadToFile. I was thinking of saving the image to the server's hard drive and then displaying the image. The function returns OK, but the file never gets saved. There may be a file system permission problem going on, but I'm not certain.

I also tried using a perl module called LWP::Useragent, but since I don't know perl very well I never got it to work.

Any info would be appreciated, thanks.

Top
#248913 - 10/02/2005 19:14 Re: Question: Web page images [Re: Folsom]
Dignan
carpal tunnel

Registered: 08/03/2000
Posts: 12341
Loc: Sterling, VA
Does this do what you want? This just says you need to be able to send HTTP requests on port 80.

*edit*
Which DLink camera do you have? Do you like it? I've been considering getting a webcam for a long while, but haven't found one I like.


Edited by Dignan17 (10/02/2005 19:19)
_________________________
Matt

Top
#248914 - 10/02/2005 20:31 Re: Question: Web page images [Re: Dignan]
Folsom
member

Registered: 12/08/2001
Posts: 175
Loc: Atlanta
Quote:
Does this do what you want?

It looks like that software only works for webcams. I have a DCS-900, and it has a server that supplies images. I can pull the latest image by grabbing "image.jpg" from the camera.

The camera works OK, and it comes with software that will record/monitor the camera. It only costs $30 after rebate, so that is why I got it.

Top
#248915 - 10/02/2005 20:33 Re: Question: Web page images [Re: Folsom]
g_attrill
old hand

Registered: 14/04/2002
Posts: 1172
Loc: Hants, UK
If you don't want to open an incoming port then you will need software to publish *to* the site, rather than from. You would need some software as listed.

Regarding your ASP problem - make sure you have write permissions for IUSR_machinename, although this normally produces a "permission denied" error. If you have an empty file then you probably have some duff code. To download files on ASP I have found the most reliable method is down using WinHttpRequest and then write with FileSystemObject calls (which I can't remember off-hand, but there are loads of examples on the 'net).

Gareth

Top
#248916 - 12/02/2005 00:47 Re: Question: Web page images [Re: g_attrill]
Folsom
member

Registered: 12/08/2001
Posts: 175
Loc: Atlanta
Thanks for the pointers. I got the script to work. Is there a way to send the output of WinHttpRequest directly instead of saving the image on the hard drive and then displaying it?

Top
#248917 - 12/02/2005 12:24 Re: Question: Web page images [Re: Folsom]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
Quote:
Thanks for the pointers. I got the script to work. Is there a way to send the output of WinHttpRequest directly instead of saving the image on the hard drive and then displaying it?


Probably.

The WinHttpRequest object has a ResponseStream property which returns an IStream object.

If I remember correctly one of the things that the Response.Write method can accept is an IStream object. So calling Response.Write and passing the WinHttpRequest.ResponseStream should write out the image you grabbed.

You will also have to set the Response.ContentType to the relevant mime type for the image format.

Edit:

I was nearly right. You need to do:

dim oBody
oBody = oWinHTTP.responseBody
Response.BinaryWrite oBody

In theory you could just do:

Response.BinaryWrite oWinHTTP.responseBody

but I have had that fail in strange ways in the past


Edited by andy (12/02/2005 19:08)
_________________________
Remind me to change my signature to something more interesting someday

Top