RE: [PHP] SVG and PHP

From: Date: Tue, 05 Jan 2010 20:15:12 +0000
Subject: RE: [PHP] SVG and PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-300828@lists.php.net to get a copy of this message
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/

« previous php.general (#300828) next »