Re: [PHP] SVG and PHP

2010-01-11 Thread haliphax
On Wed, Jan 6, 2010 at 5:04 PM, Bob Strasser bstras...@noccorp.com wrote:


 Hi,

  Just went online and saw an SVG generated from Python, and wanted to
 do the similar thing by loading the SVG into an PHP script. Here is the
 script that I have:

 ?php

 #Load the Map
 $ourFileName= USA_Counties_with_FIPS_and_names.svg;
 $fh = fopen($ourFileName, r) or die(Can't open file);
 fclose($fh);

 ?

 The problem is that my screen appears as blank even though I could open
 up USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does
 anyone know what I might have done wrong here?

 Thanks in advance.

 Alice


Bob/Alice/Whatever,

You don't do anything with the SVG file except open it and close it. Opening
and closing a door doesn't walk you through the doorway. Maybe you should
echo the contents of said file after sending a Content-Type header through
to the browser?


// Todd


[PHP] SVG and PHP

2010-01-06 Thread Bob Strasser

Hi, 

  Just went online and saw an SVG generated from Python, and wanted to
do the similar thing by loading the SVG into an PHP script. Here is the
script that I have: 

?php
 
#Load the Map
$ourFileName= USA_Counties_with_FIPS_and_names.svg;
$fh = fopen($ourFileName, r) or die(Can't open file);
fclose($fh); 

?

The problem is that my screen appears as blank even though I could open
up USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does
anyone know what I might have done wrong here? 

Thanks in advance. 

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SVG and PHP

2010-01-06 Thread Bob Strasser

Hi, 

  Just went online and saw an SVG generated from Python, and wanted to
do the similar thing by loading the SVG into an PHP script. Here is the
script that I have: 

?php
 
#Load the Map
$ourFileName= USA_Counties_with_FIPS_and_names.svg;
$fh = fopen($ourFileName, r) or die(Can't open file);
fclose($fh); 

?

The problem is that my screen appears as blank even though I could open
up USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does
anyone know what I might have done wrong here? 

Thanks in advance. 

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SVG and PHP

2010-01-06 Thread Bob Strasser

Hi, 

  Just went online and saw an SVG generated from Python, and wanted to
do the similar thing by loading the SVG into an PHP script. Here is the
script that I have: 

?php
 
#Load the Map
$ourFileName= USA_Counties_with_FIPS_and_names.svg;
$fh = fopen($ourFileName, r) or die(Can't open file);
fclose($fh); 

?

The problem is that my screen appears as blank even though I could open
up USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does
anyone know what I might have done wrong here? 

Thanks in advance. 

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SVG and PHP

2010-01-05 Thread Alice Wei

Hi, 

  Just went online and saw an SVG generated from Python, and wanted to do the 
similar thing by loading the SVG into an PHP script. Here is the script that I 
have: 

?php
 
#Load the Map
$ourFileName= USA_Counties_with_FIPS_and_names.svg;
$fh = fopen($ourFileName, r) or die(Can't open file);
fclose($fh); 

?

The problem is that my screen appears as blank even though I could open up 
USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
know what I might have done wrong here? 

Thanks in advance. 

Alice
  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/

Re: [PHP] SVG and PHP

2010-01-05 Thread Bruno Fajardo
2010/1/5 Alice Wei aj...@alumni.iu.edu


 Hi,

  Just went online and saw an SVG generated from Python, and wanted to do
 the similar thing by loading the SVG into an PHP script. Here is the script
 that I have:

 ?php

 #Load the Map
 $ourFileName= USA_Counties_with_FIPS_and_names.svg;
 $fh = fopen($ourFileName, r) or die(Can't open file);
 fclose($fh);

 ?

 The problem is that my screen appears as blank even though I could open up
 USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone
 know what I might have done wrong here?


Aren't you just opening the file? I think that you need to print it in some
way suitable to your application.
Try using fread() or other function to read the contents of the file.



 Thanks in advance.

 Alice

 _
 Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
 http://clk.atdmt.com/GBL/go/177141664/direct/01/


Re: [PHP] SVG and PHP

2010-01-05 Thread Ashley Sheridan
On Tue, 2010-01-05 at 14:57 -0500, Alice Wei wrote:

 Hi, 
 
   Just went online and saw an SVG generated from Python, and wanted to do the 
 similar thing by loading the SVG into an PHP script. Here is the script that 
 I have: 
 
 ?php
  
 #Load the Map
 $ourFileName= USA_Counties_with_FIPS_and_names.svg;
 $fh = fopen($ourFileName, r) or die(Can't open file);
 fclose($fh); 
 
 ?
 
 The problem is that my screen appears as blank even though I could open up 
 USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
 know what I might have done wrong here? 
 
 Thanks in advance. 
 
 Alice
 
 _
 Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
 http://clk.atdmt.com/GBL/go/177141664/direct/01/


If you go the fopen route, you need to get the contents of the file and
print them out to the browser, with the correct SVG headers. All you're
doing here creating a read-only resource to the file.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] SVG and PHP

2010-01-05 Thread Alice Wei



Hi,



  Just went online and saw an SVG generated from Python, and wanted to do the 
similar thing by loading the SVG into an PHP script. Here is the script that I 
have:



?php



#Load the Map

$ourFileName= USA_Counties_with_FIPS_and_names.svg;

$fh = fopen($ourFileName, r) or die(Can't open file);

fclose($fh);



?



The problem is that my screen appears as blank even though I could open up 
USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
know what I might have done wrong here?

Aren't you just opening the file? I think that you need to print it in some way 
suitable to your application.


Try using fread() or other function to read the contents of the file.
 
  Well, I tried, and here is the complete code of the portion I just edited:

#Load the Map
$ourFileName= USA_Counties_with_FIPS_and_names.svg;
$fh = fopen($ourFileName, r) or die(Can't open file);
$contents = fread($fh,filesize($ourFileName));
echo $contents;
fclose($fh); 
 
Now I get something on the screen, but still no image: image/svg+xml
Um, is there anything particular I need to put in my code? 


Thanks in advance.



Alice



_

Hotmail: Trusted email with Microsoft’s powerful SPAM protection.

http://clk.atdmt.com/GBL/go/177141664/direct/01/
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/

RE: [PHP] SVG and PHP

2010-01-05 Thread Ashley Sheridan
On Tue, 2010-01-05 at 15:15 -0500, Alice Wei wrote:

 
 
 Hi,
 
 
 
   Just went online and saw an SVG generated from Python, and wanted to do the 
 similar thing by loading the SVG into an PHP script. Here is the script that 
 I have:
 
 
 
 ?php
 
 
 
 #Load the Map
 
 $ourFileName= USA_Counties_with_FIPS_and_names.svg;
 
 $fh = fopen($ourFileName, r) or die(Can't open file);
 
 fclose($fh);
 
 
 
 ?
 
 
 
 The problem is that my screen appears as blank even though I could open up 
 USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
 know what I might have done wrong here?
 
 Aren't you just opening the file? I think that you need to print it in some 
 way suitable to your application.
 
 
 Try using fread() or other function to read the contents of the file.
  
   Well, I tried, and here is the complete code of the portion I just edited:
 
 #Load the Map
 $ourFileName= USA_Counties_with_FIPS_and_names.svg;
 $fh = fopen($ourFileName, r) or die(Can't open file);
 $contents = fread($fh,filesize($ourFileName));
 echo $contents;
 fclose($fh); 
  
 Now I get something on the screen, but still no image: image/svg+xml
 Um, is there anything particular I need to put in my code? 
 
 
 Thanks in advance.
 
 
 
 Alice
 
 
 
 _
 
 Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
 
 http://clk.atdmt.com/GBL/go/177141664/direct/01/  
   
 _
 Hotmail: Trusted email with powerful SPAM protection.
 http://clk.atdmt.com/GBL/go/177141665/direct/01/


View the source of your browser. Is it showing the SVG code? You need to
output the correct mime-type headers for the SVG, as by default, PHP
outputs headers for HTML. Something like this should do the trick:

header(Content-type: image/svg+xml);

This has to occur before any output has already been sent to the
browser, otherwise you'll get a headers already sent error.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] SVG and PHP

2010-01-05 Thread Alice Wei







  
  


On Tue, 2010-01-05 at 15:15 -0500, Alice Wei wrote:



Hi,



  Just went online and saw an SVG generated from Python, and wanted to do the 
similar thing by loading the SVG into an PHP script. Here is the script that I 
have:



?php



#Load the Map

$ourFileName= USA_Counties_with_FIPS_and_names.svg;

$fh = fopen($ourFileName, r) or die(Can't open file);

fclose($fh);



?



The problem is that my screen appears as blank even though I could open up 
USA_Counties_with_FIPS_and_names.svg and see the entire US Map. Does anyone 
know what I might have done wrong here?

Aren't you just opening the file? I think that you need to print it in some way 
suitable to your application.


Try using fread() or other function to read the contents of the file.
 
  Well, I tried, and here is the complete code of the portion I just edited:

#Load the Map
$ourFileName= USA_Counties_with_FIPS_and_names.svg;
$fh = fopen($ourFileName, r) or die(Can't open file);
$contents = fread($fh,filesize($ourFileName));
echo $contents;
fclose($fh); 
 
Now I get something on the screen, but still no image: image/svg+xml
Um, is there anything particular I need to put in my code? 


Thanks in advance.



Alice



_

Hotmail: Trusted email with Microsoft’s powerful SPAM protection.

http://clk.atdmt.com/GBL/go/177141664/direct/01/
  
_
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141665/direct/01/




View the source of your browser. Is it showing the SVG code? You need to output 
the correct mime-type headers for the SVG, as by default, PHP outputs headers 
for HTML. Something like this should do the trick:



header(Content-type: image/svg+xml);



This has to occur before any output has already been sent to the browser, 
otherwise you'll get a headers already sent error.


Thanks, this time it does the trick. 





Thanks,

Ash

http://www.ashleysheridan.co.uk







  
_
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/171222984/direct/01/