Two things: 1. You're not sending an image/jpg header() in your image file. The browser won't know what kind of data it's receiving.
2. You need to reference your image in the <img> tag through a web server, that way the PHP code is parsed. <img src=http://www.yourdomain.com/make_image.php> or even just a relative URL to the file <img src="images/make_image.php"> okay, one more: 3. Why not just set a cron script to run a program to copy the image to your machine every X minutes. Then you can just reference it like any other image. With the setup you have now, you're going to be using a lot more resources because the PHP script will have to go and read that URL and make the image with every request. and one more, just because: 4. I hope you're not violating any copyrights. ---John Holmes... > -----Original Message----- > From: Anthony Ritter [mailto:[EMAIL PROTECTED]] > Sent: Saturday, October 12, 2002 12:24 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] =.jpg from another URL with PHP= > > Thanks to all for your respones to my inquiry. > > I placed the PHP script to open the .jpg from another URL in another file > and then inserted the HTML <IMG> tag to reference that file. The result > was that it outputted a small sqaure with a red x - but no image of the > map. > > Any advice would be greatly appreciated. > > Tony Ritter > > The scripts follow... > ................................................................... > > <HTML> > <HEAD> > <SCRIPT LANGUAGE="JavaScript"> > function findTheAnswer() > { > var number_one=window.document.the_form.field_one.value; > var product=Math.round(9/5* number_one + 32); > alert("The water temperature is " + product + " degrees fahrenheit"); > document.the_form.field_one.value="" > document.the_form.field_one.focus() > } > </SCRIPT> > > <? > function getUSGS($data, $station) > { > $data; > $content = file($data); > array_pop($content); > $current = array_pop($content); > $newcurrent = explode("\t",$current); > print("<table border=1 ALIGN=CENTER>"); > print("<tr><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" size > =1>$station</Font></td><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" size > =1>Station</Font></td><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" size > =1>Date and Time</Font></td><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" > size =1>Height</Font></td><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" > size > =1>CFS</Font></td><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" size > =1>Temperature</Font></td></tr>"); > print("<tr><td><Font Face=\"arial\" > size=1>$newcurrent[0]</Font></td><td><Font Face=\"arial\" > size=1>$newcurrent[1]</Font></td><td><Font Face=\"arial\" > size=1>$newcurrent[2]</Font></td><td><Font Face=\"arial\" > size=1>$newcurrent[3]</font></td><td><Font Face=\"arial\" > size=1>$newcurrent[4]</font></td><td><Font Face=\"arial\" > size=1>$newcurrent[5]</font></td></tr>"); > print("</table>"); > } > ?> > > <BODY> > <FONT FACE="arial" SIZE=2> > These tables represent real time data from the United States Geological > Survey. > The numbers will change every fifteen minutes to reflect the changes in > water temperatures > and water levels at the following stations in the Delaware River drainage. > Optimum water temperatures > for the following gamefish are listed below. > <FONT FACE="arial" SIZE=1> > <TABLE BORDER=0 ALIGN=CENTER> > <TR><TD BGCOLOR="#FFE4C4"><FONT FACE="arial" SIZE=1>B r o w n T r o u t > </FONT></TD><TD BGCOLOR="#FFE4C4"><FONT FACE="arial" SIZE=1>R a i n b o w > T > r o u t </FONT></TD><TD BGCOLOR="#FFE4C4"><FONT FACE="arial" SIZE=1>S h a > d > </FONT></TD><TD BGCOLOR="#FFE4C4"><FONT FACE="arial" SIZE=1>S m a l l m o > u > t h B a s s </FONT></TD><TD BGCOLOR="#FFE4C4"><FONT FACE="arial" SIZE=1>W > a > l l e y e </FONT></TD></TR> > <TR><TD><FONT FACE="arial" SIZE=1>48 to 62 degrees</FONT></TD><TD><FONT > FACE="arial" SIZE=1>54 to 68 degrees</FONT></TD><TD><FONT FACE="arial" > SIZE=1>52 to 66 degrees</FONT></TD><TD><FONT FACE="arial" SIZE=1>67 to 77 > degrees</FONT></TD><TD><FONT FACE="arial" SIZE=1>Below 50 > degrees</FONT></TD></TR> > <P><BR> > </TABLE> > <BR> > </FONT> > > > <? > getUSGS("http://waterdata.usgs.gov/ny/nwis/uv?format=rdb&period=1&site_n o= > 01 > 427510","Upper Delaware River at Callicoon, NY"); > print("<P ALIGN=\"CENTER\"><FONT FACE=\"arial\" COLOR=\"red\" > SIZE=1>Normal > water levels on the main stem are from 2.7 to 3.2 feet or 600 to 1500 > cfs.<BR></FONT>"); > print("<FONT FACE=\"arial\" COLOR=\"red\" SIZE=1> > <ALIGN=\"CENTER\">Anglers > should use caution above 3.3 feet and the river is not wadable at 3.5 feet > and above.</FONT><BR>"); > > getUSGS("http://waterdata.usgs.gov/ny/nwis/uv?format=rdb&period=1&site_n o= > 01 > 426500","W. Br. Delaware River at Hale Eddy, NY"); > > getUSGS("http://waterdata.usgs.gov/ny/nwis/uv?format=rdb&period=1&site_n o= > 01 > 420500","Beaverkill River at C o o k s F a l l s, NY"); > > getUSGS("http://waterdata.usgs.gov/ny/nwis/uv?format=rdb&period=1&site_n o= > 01 > 427500"," C a l l i c o o n C r e e k a t Callicoon, NY"); > ?> > > <FORM NAME="the_form"> > <FONT FACE="arial" SIZE=1> Enter <b><i>Celsius</b></i> number > here:</FONT> > <INPUT TYPE=="text" NAME="field_one" size="3" > > <a href = # onClick="findTheAnswer(); return false;"><FONT FACE="arial" > SIZE=1> Click this line to convert to Fahrenheit</A></FONT> > </FORM> > > <FONT FACE="arial" SIZE =1>Click <A HREF="http://localhost/Map.php"> > here</A> for Real Time 600 mile Northeast Doppler Radar Map.</FONT> > <P> > > </BODY> > </HTML> > ........................................................................ .. > .. > .. > > // file:C:/ColorMap.php > // PHP script to open the .jpg file. > > > <? > $theURL="http://image.weather.com/web/radar/us_har_closeradar_medium_use n. > jp > g"; > if(!($fp=fopen($theURL, "r"))) > { > print("Could not open the URL."); > exit; > } > $contents=fread($fp,1000000); > print($contents); > fclose($fp); > ?> > > ............................................... > > > <HTML> > <HEAD> > <BODY> > This is a test. > <IMG SRC="C:/ColorMap.php"> > </BODY> > </HTML> > // This page outputs: This is a test - with a small square and a red x - > no > image of the map. > ................................................... > > > > John W. Holmes wrote in message: > > Make another file that has your code in it and sends an image/jpeg > header. Then insert the image like any other image: > > <img src='yourfile.php'> > > Hope you're not violating any copyrights... > > ---John Holmes... > .................................................. > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php