Log in

View Full Version : Getting an image from a website


Raven_Writer
05-06-2004, 09:23
Every day, NASA's Astronomy site (http://antwrp.gsfc.nasa.gov/apod/astropix.html) puts up a new image. What I'm wondering is how could I check to see if there is a new image, and if so display it (download it, or something). I don't even know if this is possible.

If you can help at all, please let me know.

Astronouth7303
05-06-2004, 09:48
In what? In VB, you have the Inet control. You download the homepage and find "<IMG SRC=""" (2 double quotes is a double quote w/o ending the string). Then you take what's between that and """". That is your path. Again using the Inet control, download the image using the path extracted, and save it to a location. Then you can do whatever with it.

Raven_Writer
05-06-2004, 11:01
In what? In VB, you have the Inet control. You download the homepage and find "<IMG SRC=""" (2 double quotes is a double quote w/o ending the string). Then you take what's between that and """". That is your path. Again using the Inet control, download the image using the path extracted, and save it to a location. Then you can do whatever with it.Sorry about that, I forgot to mention to display it on another website. Like, would it be possible to do this through PHP, or even ASP? Thanks though very much.

Astronouth7303
05-06-2004, 11:20
Sorry about that, I forgot to mention to display it on another website. Like, would it be possible to do this through PHP, or even ASP? Thanks though very much.
You mean other than having windows run a VBscript? ;) no idea.

Tom Bottiglieri
05-06-2004, 11:22
is it just me.. or does the pic for 6/5 ( http://antwrp.gsfc.nasa.gov/apod/image/0406/rover_apollo17_big.jpg ) look fake?

Joe Ross
05-06-2004, 11:24
I would use a cron script that would download the page with wget, delete the html file, then rename the .jpg to the file that you are displaying on your webpage.

Raven_Writer
05-06-2004, 11:24
is it just me.. or does the pic for 6/5 ( http://antwrp.gsfc.nasa.gov/apod/image/0406/rover_apollo17_big.jpg ) look fake?Heh. Yea, I kinda thought the same.

A lot of the pictures on there are sweet none-the-less, even if they are fake, though.

Joe: Thanks, I'll try that and see what happens.

Astronouth7303
05-06-2004, 11:37
is it just me.. or does the pic for 6/5 ( http://antwrp.gsfc.nasa.gov/apod/image/0406/rover_apollo17_big.jpg ) look fake?
really? how so?

Max Lobovsky
05-06-2004, 17:00
really? how so?I think they were watching that stupid FOX special about how the Apollo landings were fake. Please see here if you were convinced by that propaganda: http://www.badastronomy.com/bad/tv/iangoddard/moon01.htm.

Astronouth7303
05-06-2004, 20:19
I think they were watching that stupid FOX special about how the Apollo landings were fake. Please see here if you were convinced by that propaganda: http://www.badastronomy.com/bad/tv/iangoddard/moon01.htm.
I heard about that. My question to the conspirisy theorists: Where'd the cash go?

ahecht
08-06-2004, 03:23
I currently have my home computer set up to download the Astronomy Picture of the Day every day, resize it, and put it in my background rotation automatically.

To do it, I used a combination of DailyStrips (http://dailystrips.sourceforge.net/) and ImageMagick (ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/ImageMagick-6.0.0-Q16-windows-dll.exe).

Full instructions are on my web site at http://zansstuff.com/rotatedesktop.html#apod

If you just want to display it on another web site, DailyStrips is a Perl script, and you could set it up to run as a chron job (and write a little script to rename each day's file to a constant name or modify the Perl to always output the same name), or you could modify it so that it displayed the fetched image as an output when called by a browser.

greencactus3
08-06-2004, 13:10
I heard about that. My question to the conspirisy theorists: Where'd the cash go?
not that i dont believe that nasa landed on the moon, but its the government. where do you think our money goes ;)
and if you got a wad of cash and was told you can either use it all up, or you can use half of it to let everyone believe you used it all up, and you keep the rest,which would you do? :D

Ryan F.
08-06-2004, 13:43
I heard about that. My question to the conspirisy theorists: Where'd the cash go?

Where did the rocket go?

--Also....elvis is surely still alive!

seanwitte
08-06-2004, 14:07
The .NET Framework includes a class named WebRequest that will do what you're asking. You give it a URL and it returns the results as a stream. Then you just read the stream and write it to disk. Check MSDN, there is probably some sample code available.

Greg Needel
09-06-2004, 09:02
but its the government. where do you think our money goes


"you don't think they spend 200 dollars on a hammer, 500 bucks on a toliot seat do you?"

Greg
09-06-2004, 10:55
In PHP, you can also use socket connections (similar to the Inet control in VB). Your hosting service has to allow it though :) By the way, fopen will open remote files too.

Raven_Writer
09-06-2004, 11:21
I currently have my home computer set up to download the Astronomy Picture of the Day every day, resize it, and put it in my background rotation automatically.

To do it, I used a combination of DailyStrips (http://dailystrips.sourceforge.net/) and ImageMagick (ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/ImageMagick-6.0.0-Q16-windows-dll.exe).

Full instructions are on my web site at http://zansstuff.com/rotatedesktop.html#apod
Thank you :)

I've checked that out, and as soon as finals are over with, I will try that and see what happens.

Greg: I started thinking about that, but the problem is that NASA creates a new directory (as far as I know) each day for the pictures.

Astronouth7303
09-06-2004, 11:39
Greg: I started thinking about that, but the problem is that NASA creates a new directory (as far as I know) each day for the pictures.
At least a different file for each picture. You pretty much have to extract the URL from the page.