
session variables and SVG documents
--001485f7757ef58f13047e879038
Content-Type: text/plain; charset=ISO-8859-1
Hello,
I have the following problem with the Adobe SVG viewer:
I try to generate a SVG document using PHP. the following code is working
well under Firefox, as well as IE with ASV:
<?php
header("Content-type: image/svg+xml");
$graph_title = 'title';
print('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>');
$svgwidth=500;
$svgheight=400;
?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
http://www.w3.org/TR/SVG/DTD/svg10.dtd">
<svg width="<?php echo $svgwidth; ?>px" height="<?php echo $svgheight; ?>px"
xmlns="http://www.w3.org/2000/svg">
<desc>This is a php-random rectangle test</desc>
<?php
srand((double) microtime() * 1000000); //initalizing random generator
for ($i = 0; $i < 20; $i+=1) {
$x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
function
$y = floor(rand(0,$svgheight-1));
$width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
viewbox
$height = floor(rand(0,$svgheight-$y));
$red = floor(rand(0,255));
$blue = floor(rand(0,255));
$green = floor(rand(0,255));
$color = "rgb(".$red.",".$green.",".$
blue.")";
print "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
style=\"fill:$color;\"/>\n";
}
?>
<text x="<?php echo $svgwidth/2;?>px" y="300" style="font-size:15;"
text-anchor="middle">The servers Date and Time is: <?php print
(strftime("%Y-%m-%d, %H:%M:%S")); ?></text>
<text x="<?php echo $svgwidth/2;?>px" y="340" style="font-size:15;"
text-anchor="middle">You are running:</text>
<text x="<?php echo $svgwidth/2;?>px" y="360" style="font-size:15;"
text-anchor="middle"><?php print $HTTP_USER_AGENT; ?></text>
</svg>
If now I want to include the session_start() at the beginning of the code,
in IE I got a pop-up dialog called "download file"
What am I doing wrong ?
Regards,
Aurelie
--001485f7757ef58f13047e879038--
Re: session variables and SVG documents
--=-89fd5me1H/NSByVVsmo4
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Mon, 2010-02-01 at 11:37 +0100, Aurelie REYMUND wrote:
> Hello,
>
> I have the following problem with the Adobe SVG viewer:
> I try to generate a SVG document using PHP. the following code is working
> well under Firefox, as well as IE with ASV:
>
> <?php
>
> header("Content-type: image/svg+xml");
>
> $graph_title = 'title';
>
>
> print('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>');
> $svgwidth=500;
> $svgheight=400;
> ?>
>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
> http://www.w3.org/TR/SVG/DTD/svg10.dtd">
> <svg width="<?php echo $svgwidth; ?>px" height="<?php echo $svgheight; ?>px"
> xmlns="http://www.w3.org/2000/svg">
> <desc>This is a php-random rectangle test</desc>
> <?php
> srand((double) microtime() * 1000000); //initalizing random generator
> for ($i = 0; $i < 20; $i+=1) {
> $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
> function
> $y = floor(rand(0,$svgheight-1));
> $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
> viewbox
> $height = floor(rand(0,$svgheight-$y));
> $red = floor(rand(0,255));
> $blue = floor(rand(0,255));
> $green = floor(rand(0,255));
> $color = "rgb(".$red.",".$green.",".$
> blue.")";
> print "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
> style=\"fill:$color;\"/>\n";
> }
> ?>
> <text x="<?php echo $svgwidth/2;?>px" y="300" style="font-size:15;"
> text-anchor="middle">The servers Date and Time is: <?php print
> (strftime("%Y-%m-%d, %H:%M:%S")); ?></text>
> <text x="<?php echo $svgwidth/2;?>px" y="340" style="font-size:15;"
> text-anchor="middle">You are running:</text>
> <text x="<?php echo $svgwidth/2;?>px" y="360" style="font-size:15;"
> text-anchor="middle"><?php print $HTTP_USER_AGENT; ?></text>
> </svg>
>
> If now I want to include the session_start() at the beginning of the code,
> in IE I got a pop-up dialog called "download file"
>
> What am I doing wrong ?
>
> Regards,
> Aurelie
It sounds like it's the SVG plugin you're using on IE that's badly
misbehaving. That said, I've not seen any plugins that correctly pass
across the full headers that the browser would. I tried using sessions
once to secure media files by checking for a valid login against the
session id, but the plugins requesting the video clips didn't send any
cookie data in the header request. As such, it might be better to not
rely on it in this case.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-89fd5me1H/NSByVVsmo4--
Re: session variables and SVG documents
From: "Aurelie REYMUND" <aurely001 [at] gmail.com>
Sent: Monday, February 01, 2010 3:37 AM
To: <php-general [at] lists.php.net>
Subject: [PHP] session variables and SVG documents
> Hello,
>
> I have the following problem with the Adobe SVG viewer:
> I try to generate a SVG document using PHP. the following code is working
> well under Firefox, as well as IE with ASV:
>
> <?php
>
> header("Content-type: image/svg+xml");
>
> $graph_title = 'title';
>
>
> print('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>');
> $svgwidth=500;
> $svgheight=400;
> ?>
>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
> http://www.w3.org/TR/SVG/DTD/svg10.dtd">
> <svg width="<?php echo $svgwidth; ?>px" height="<?php echo $svgheight;
> ?>px"
> xmlns="http://www.w3.org/2000/svg">
> <desc>This is a php-random rectangle test</desc>
> <?php
> srand((double) microtime() * 1000000); //initalizing random generator
> for ($i = 0; $i < 20; $i+=1) {
> $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
> function
> $y = floor(rand(0,$svgheight-1));
> $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
> viewbox
> $height = floor(rand(0,$svgheight-$y));
> $red = floor(rand(0,255));
> $blue = floor(rand(0,255));
> $green = floor(rand(0,255));
> $color = "rgb(".$red.",".$green.",".$
> blue.")";
> print "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
> style=\"fill:$color;\"/>\n";
> }
> ?>
> <text x="<?php echo $svgwidth/2;?>px" y="300" style="font-size:15;"
> text-anchor="middle">The servers Date and Time is: <?php print
> (strftime("%Y-%m-%d, %H:%M:%S")); ?></text>
> <text x="<?php echo $svgwidth/2;?>px" y="340" style="font-size:15;"
> text-anchor="middle">You are running:</text>
> <text x="<?php echo $svgwidth/2;?>px" y="360" style="font-size:15;"
> text-anchor="middle"><?php print $HTTP_USER_AGENT; ?></text>
> </svg>
>
> If now I want to include the session_start() at the beginning of the code,
> in IE I got a pop-up dialog called "download file"
>
> What am I doing wrong ?
>
> Regards,
> Aurelie
>
It appears IE does not support svg yet and you need a plugin for it.
However, you could also design your code differently by using Imagemagick to
convert the svg to png.
If that suits your needs, then use the modified code below:
<?php
header("Content-type: image/png");
$graph_title = 'title';
$svgwidth=500;
$svgheight=400;
$svg = '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<svg width="'.$svgwidth.'px" height="'.$svgheight.'px"
xmlns="http://www.w3.org/2000/svg">
<desc>This is a php-random rectangle test</desc>';
for ($i = 0; $i < 20; $i++) {
$x = floor(rand(0,$svgwidth-1));
$y = floor(rand(0,$svgheight-1));
$width = floor(rand(0,$svgwidth-$x));
$height = floor(rand(0,$svgheight-$y));
$red = floor(rand(0,255));
$blue = floor(rand(0,255));
$green = floor(rand(0,255));
$color = "rgb(".$red.",".$green.",".$blue.")";
$svg .= "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
style=\"fill:$color;\"/>\n";
}
$svg .= '<text x="'.($svgwidth/2).'px" y="300" style="font-size:15;"
text-anchor="middle">The servers Date and Time is: '.date("Y-m-d,
H:m:s").'</text>
<text x="'.($svgwidth/2).'px" y="340" style="font-size:15;"
text-anchor="middle">You are running:</text>
<text x="'.($svgwidth/2).'px" y="360" style="font-size:15;"
text-anchor="middle">'.$HTTP_USER_AGENT.'</text>
</svg>';
file_put_contents('/tmp/image.svg', $svg);
exec("/usr/bin/rsvg /tmp/image.svg /tmp/image.png");
echo file_get_contents('/tmp/image.png');
?>
-Ray Solomon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: session variables and SVG documents
--0016e6409562e84c85047eaf23ad
Content-Type: text/plain; charset=ISO-8859-1
Hello,
unfortunately, it does not suite my needs. The image must be clickable. The
application I'm developping reads data from a database and display the
information graphically. The user must be able to click on some elements of
the picture, and I have to store the information the user clicked on
(session vars). I cannot tell the user not to use IE, so I have to find
another solution...
Regards,
Aurelie
2010/2/1 Ray Solomon <ray [at] bigdoghost.com>
> From: "Aurelie REYMUND" <aurely001 [at] gmail.com>
> Sent: Monday, February 01, 2010 3:37 AM
> To: <php-general [at] lists.php.net>
> Subject: [PHP] session variables and SVG documents
>
>
> Hello,
>>
>> I have the following problem with the Adobe SVG viewer:
>> I try to generate a SVG document using PHP. the following code is working
>> well under Firefox, as well as IE with ASV:
>>
>> <?php
>>
>> header("Content-type: image/svg+xml");
>>
>> $graph_title = 'title';
>>
>>
>> print('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>');
>> $svgwidth=500;
>> $svgheight=400;
>> ?>
>>
>> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
>> http://www.w3.org/TR/SVG/DTD/svg10.dtd">
>> <svg width="<?php echo $svgwidth; ?>px" height="<?php echo $svgheight;
>> ?>px"
>> xmlns="http://www.w3.org/2000/svg">
>> <desc>This is a php-random rectangle test</desc>
>> <?php
>> srand((double) microtime() * 1000000); //initalizing random generator
>> for ($i = 0; $i < 20; $i+=1) {
>> $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
>> function
>> $y = floor(rand(0,$svgheight-1));
>> $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
>> viewbox
>> $height = floor(rand(0,$svgheight-$y));
>> $red = floor(rand(0,255));
>> $blue = floor(rand(0,255));
>> $green = floor(rand(0,255));
>> $color = "rgb(".$red.",".$green.",".$
>> blue.")";
>> print "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
>> style=\"fill:$color;\"/>\n";
>> }
>> ?>
>> <text x="<?php echo $svgwidth/2;?>px" y="300" style="font-size:15;"
>> text-anchor="middle">The servers Date and Time is: <?php print
>> (strftime("%Y-%m-%d, %H:%M:%S")); ?></text>
>> <text x="<?php echo $svgwidth/2;?>px" y="340" style="font-size:15;"
>> text-anchor="middle">You are running:</text>
>> <text x="<?php echo $svgwidth/2;?>px" y="360" style="font-size:15;"
>> text-anchor="middle"><?php print $HTTP_USER_AGENT; ?></text>
>> </svg>
>>
>> If now I want to include the session_start() at the beginning of the code,
>> in IE I got a pop-up dialog called "download file"
>>
>> What am I doing wrong ?
>>
>> Regards,
>> Aurelie
>>
>>
>
> It appears IE does not support svg yet and you need a plugin for it.
>
> However, you could also design your code differently by using Imagemagick
> to convert the svg to png.
> If that suits your needs, then use the modified code below:
>
>
> <?php
>
> header("Content-type: image/png");
>
> $graph_title = 'title';
>
> $svgwidth=500;
> $svgheight=400;
>
> $svg = '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
> <svg width="'.$svgwidth.'px" height="'.$svgheight.'px" xmlns="
> http://www.w3.org/2000/svg">
> <desc>This is a php-random rectangle test</desc>';
>
>
> for ($i = 0; $i < 20; $i++) {
>
> $x = floor(rand(0,$svgwidth-1));
> $y = floor(rand(0,$svgheight-1));
> $width = floor(rand(0,$svgwidth-$x));
> $height = floor(rand(0,$svgheight-$y));
> $red = floor(rand(0,255));
> $blue = floor(rand(0,255));
> $green = floor(rand(0,255));
> $color = "rgb(".$red.",".$green.",".$blue.")";
> $svg .= "\t<rect x=\"$x\" y=\"$y\" width=\"$width\"
> height=\"$height\" style=\"fill:$color;\"/>\n";
> }
>
> $svg .= '<text x="'.($svgwidth/2).'px" y="300" style="font-size:15;"
> text-anchor="middle">The servers Date and Time is: '.date("Y-m-d,
> H:m:s").'</text>
> <text x="'.($svgwidth/2).'px" y="340" style="font-size:15;"
> text-anchor="middle">You are running:</text>
> <text x="'.($svgwidth/2).'px" y="360" style="font-size:15;"
> text-anchor="middle">'.$HTTP_USER_AGENT.'</text>
> </svg>';
>
>
> file_put_contents('/tmp/image.svg', $svg);
>
> exec("/usr/bin/rsvg /tmp/image.svg /tmp/image.png");
>
> echo file_get_contents('/tmp/image.png');
> ?>
>
> -Ray Solomon
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--0016e6409562e84c85047eaf23ad--
Re: session variables and SVG documents
--=-uMISyHFy4OAY39bujxw7
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Wed, 2010-02-03 at 10:49 +0100, Aurelie REYMUND wrote:
> Hello,
>
> unfortunately, it does not suite my needs. The image must be clickable. The
> application I'm developping reads data from a database and display the
> information graphically. The user must be able to click on some elements of
> the picture, and I have to store the information the user clicked on
> (session vars). I cannot tell the user not to use IE, so I have to find
> another solution...
>
> Regards,
> Aurelie
>
> 2010/2/1 Ray Solomon <ray [at] bigdoghost.com>
>
> > From: "Aurelie REYMUND" <aurely001 [at] gmail.com>
> > Sent: Monday, February 01, 2010 3:37 AM
> > To: <php-general [at] lists.php.net>
> > Subject: [PHP] session variables and SVG documents
> >
> >
> > Hello,
> >>
> >> I have the following problem with the Adobe SVG viewer:
> >> I try to generate a SVG document using PHP. the following code is working
> >> well under Firefox, as well as IE with ASV:
> >>
> >> <?php
> >>
> >> header("Content-type: image/svg+xml");
> >>
> >> $graph_title = 'title';
> >>
> >>
> >> print('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>');
> >> $svgwidth=500;
> >> $svgheight=400;
> >> ?>
> >>
> >> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
> >> http://www.w3.org/TR/SVG/DTD/svg10.dtd">
> >> <svg width="<?php echo $svgwidth; ?>px" height="<?php echo $svgheight;
> >> ?>px"
> >> xmlns="http://www.w3.org/2000/svg">
> >> <desc>This is a php-random rectangle test</desc>
> >> <?php
> >> srand((double) microtime() * 1000000); //initalizing random generator
> >> for ($i = 0; $i < 20; $i+=1) {
> >> $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for rand
> >> function
> >> $y = floor(rand(0,$svgheight-1));
> >> $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside of
> >> viewbox
> >> $height = floor(rand(0,$svgheight-$y));
> >> $red = floor(rand(0,255));
> >> $blue = floor(rand(0,255));
> >> $green = floor(rand(0,255));
> >> $color = "rgb(".$red.",".$green.",".$
> >> blue.")";
> >> print "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
> >> style=\"fill:$color;\"/>\n";
> >> }
> >> ?>
> >> <text x="<?php echo $svgwidth/2;?>px" y="300" style="font-size:15;"
> >> text-anchor="middle">The servers Date and Time is: <?php print
> >> (strftime("%Y-%m-%d, %H:%M:%S")); ?></text>
> >> <text x="<?php echo $svgwidth/2;?>px" y="340" style="font-size:15;"
> >> text-anchor="middle">You are running:</text>
> >> <text x="<?php echo $svgwidth/2;?>px" y="360" style="font-size:15;"
> >> text-anchor="middle"><?php print $HTTP_USER_AGENT; ?></text>
> >> </svg>
> >>
> >> If now I want to include the session_start() at the beginning of the code,
> >> in IE I got a pop-up dialog called "download file"
> >>
> >> What am I doing wrong ?
> >>
> >> Regards,
> >> Aurelie
> >>
> >>
> >
> > It appears IE does not support svg yet and you need a plugin for it.
> >
> > However, you could also design your code differently by using Imagemagick
> > to convert the svg to png.
> > If that suits your needs, then use the modified code below:
> >
> >
> > <?php
> >
> > header("Content-type: image/png");
> >
> > $graph_title = 'title';
> >
> > $svgwidth=500;
> > $svgheight=400;
> >
> > $svg = '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
> > <svg width="'.$svgwidth.'px" height="'.$svgheight.'px" xmlns="
> > http://www.w3.org/2000/svg">
> > <desc>This is a php-random rectangle test</desc>';
> >
> >
> > for ($i = 0; $i < 20; $i++) {
> >
> > $x = floor(rand(0,$svgwidth-1));
> > $y = floor(rand(0,$svgheight-1));
> > $width = floor(rand(0,$svgwidth-$x));
> > $height = floor(rand(0,$svgheight-$y));
> > $red = floor(rand(0,255));
> > $blue = floor(rand(0,255));
> > $green = floor(rand(0,255));
> > $color = "rgb(".$red.",".$green.",".$blue.")";
> > $svg .= "\t<rect x=\"$x\" y=\"$y\" width=\"$width\"
> > height=\"$height\" style=\"fill:$color;\"/>\n";
> > }
> >
> > $svg .= '<text x="'.($svgwidth/2).'px" y="300" style="font-size:15;"
> > text-anchor="middle">The servers Date and Time is: '.date("Y-m-d,
> > H:m:s").'</text>
> > <text x="'.($svgwidth/2).'px" y="340" style="font-size:15;"
> > text-anchor="middle">You are running:</text>
> > <text x="'.($svgwidth/2).'px" y="360" style="font-size:15;"
> > text-anchor="middle">'.$HTTP_USER_AGENT.'</text>
> > </svg>';
> >
> >
> > file_put_contents('/tmp/image.svg', $svg);
> >
> > exec("/usr/bin/rsvg /tmp/image.svg /tmp/image.png");
> >
> > echo file_get_contents('/tmp/image.png');
> > ?>
> >
> > -Ray Solomon
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
IE doesn't display SVG natively, and the plugins for it are pants.
However, IE does make use of its own propitiatory vector language called
VML, This is how the Cufon font replacer system works.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-uMISyHFy4OAY39bujxw7--
Re: session variables and SVG documents
At 10:49 AM +0100 2/3/10, Aurelie REYMUND wrote:
>Hello,
>
>unfortunately, it does not suite my needs. The image must be clickable. The
>application I'm developping reads data from a database and display the
>information graphically. The user must be able to click on some elements of
>the picture, and I have to store the information the user clicked on
>(session vars). I cannot tell the user not to use IE, so I have to find
>another solution...
>
>Regards,
>Aurelie
Aurelie:
The image must be clickable?
I must not be understanding something. Anything can be made
clickable, just put it in an anchor, such as:
Click This
The previous post mentioned using ImageMagick to convert the svg to
png -- so write that script and place it in an anchor. I don't see
the problem.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: session variables and SVG documents
--00504502d3bc466301047eb4dd5e
Content-Type: text/plain; charset=ISO-8859-1
On Wed, Feb 3, 2010 at 8:20 AM, Ashley Sheridan <ash [at] ashleysheridan.co.uk>wrote:
> On Wed, 2010-02-03 at 10:49 +0100, Aurelie REYMUND wrote:
>
> > Hello,
> >
> > unfortunately, it does not suite my needs. The image must be clickable.
> The
> > application I'm developping reads data from a database and display the
> > information graphically. The user must be able to click on some elements
> of
> > the picture, and I have to store the information the user clicked on
> > (session vars). I cannot tell the user not to use IE, so I have to find
> > another solution...
> >
> > Regards,
> > Aurelie
> >
> > 2010/2/1 Ray Solomon <ray [at] bigdoghost.com>
> >
> > > From: "Aurelie REYMUND" <aurely001 [at] gmail.com>
> > > Sent: Monday, February 01, 2010 3:37 AM
> > > To: <php-general [at] lists.php.net>
> > > Subject: [PHP] session variables and SVG documents
> > >
> > >
> > > Hello,
> > >>
> > >> I have the following problem with the Adobe SVG viewer:
> > >> I try to generate a SVG document using PHP. the following code is
> working
> > >> well under Firefox, as well as IE with ASV:
> > >>
> > >> <?php
> > >>
> > >> header("Content-type: image/svg+xml");
> > >>
> > >> $graph_title = 'title';
> > >>
> > >>
> > >> print('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>');
> > >> $svgwidth=500;
> > >> $svgheight=400;
> > >> ?>
> > >>
> > >> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
> > >> http://www.w3.org/TR/SVG/DTD/svg10.dtd">
> > >> <svg width="<?php echo $svgwidth; ?>px" height="<?php echo $svgheight;
> > >> ?>px"
> > >> xmlns="http://www.w3.org/2000/svg">
> > >> <desc>This is a php-random rectangle test</desc>
> > >> <?php
> > >> srand((double) microtime() * 1000000); //initalizing random generator
> > >> for ($i = 0; $i < 20; $i+=1) {
> > >> $x = floor(rand(0,$svgwidth-1)); //avoid getting a range 0..0 for
> rand
> > >> function
> > >> $y = floor(rand(0,$svgheight-1));
> > >> $width = floor(rand(0,$svgwidth-$x)); //avoid getting rect outside
> of
> > >> viewbox
> > >> $height = floor(rand(0,$svgheight-$y));
> > >> $red = floor(rand(0,255));
> > >> $blue = floor(rand(0,255));
> > >> $green = floor(rand(0,255));
> > >> $color = "rgb(".$red.",".$green.",".$
> > >> blue.")";
> > >> print "\t<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\"
> > >> style=\"fill:$color;\"/>\n";
> > >> }
> > >> ?>
> > >> <text x="<?php echo $svgwidth/2;?>px" y="300" style="font-size:15;"
> > >> text-anchor="middle">The servers Date and Time is: <?php print
> > >> (strftime("%Y-%m-%d, %H:%M:%S")); ?></text>
> > >> <text x="<?php echo $svgwidth/2;?>px" y="340" style="font-size:15;"
> > >> text-anchor="middle">You are running:</text>
> > >> <text x="<?php echo $svgwidth/2;?>px" y="360" style="font-size:15;"
> > >> text-anchor="middle"><?php print $HTTP_USER_AGENT; ?></text>
> > >> </svg>
> > >>
> > >> If now I want to include the session_start() at the beginning of the
> code,
> > >> in IE I got a pop-up dialog called "download file"
> > >>
> > >> What am I doing wrong ?
> > >>
> > >> Regards,
> > >> Aurelie
> > >>
> > >>
> > >
> > > It appears IE does not support svg yet and you need a plugin for it.
> > >
> > > However, you could also design your code differently by using
> Imagemagick
> > > to convert the svg to png.
> > > If that suits your needs, then use the modified code below:
> > >
> > >
> > > <?php
> > >
> > > header("Content-type: image/png");
> > >
> > > $graph_title = 'title';
> > >
> > > $svgwidth=500;
> > > $svgheight=400;
> > >
> > > $svg = '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
> > > <svg width="'.$svgwidth.'px" height="'.$svgheight.'px" xmlns="
> > > http://www.w3.org/2000/svg">
> > > <desc>This is a php-random rectangle test</desc>';
> > >
> > >
> > > for ($i = 0; $i < 20; $i++) {
> > >
> > > $x = floor(rand(0,$svgwidth-1));
> > > $y = floor(rand(0,$svgheight-1));
> > > $width = floor(rand(0,$svgwidth-$x));
> > > $height = floor(rand(0,$svgheight-$y));
> > > $red = floor(rand(0,255));
> > > $blue = floor(rand(0,255));
> > > $green = floor(rand(0,255));
> > > $color = "rgb(".$red.",".$green.",".$blue.")";
> > > $svg .= "\t<rect x=\"$x\" y=\"$y\" width=\"$width\"
> > > height=\"$height\" style=\"fill:$color;\"/>\n";
> > > }
> > >
> > > $svg .= '<text x="'.($svgwidth/2).'px" y="300" style="font-size:15;"
> > > text-anchor="middle">The servers Date and Time is: '.date("Y-m-d,
> > > H:m:s").'</text>
> > > <text x="'.($svgwidth/2).'px" y="340" style="font-size:15;"
> > > text-anchor="middle">You are running:</text>
> > > <text x="'.($svgwidth/2).'px" y="360" style="font-size:15;"
> > > text-anchor="middle">'.$HTTP_USER_AGENT.'</text>
> > > </svg>';
> > >
> > >
> > > file_put_contents('/tmp/image.svg', $svg);
> > >
> > > exec("/usr/bin/rsvg /tmp/image.svg /tmp/image.png");
> > >
> > > echo file_get_contents('/tmp/image.png');
> > > ?>
> > >
> > > -Ray Solomon
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
>
>
> IE doesn't display SVG natively, and the plugins for it are pants.
> However, IE does make use of its own propitiatory vector language called
> VML, This is how the Cufon font replacer system works.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
Maybe svgweb (by Google) would allow you to achieve your goals:
http://code.google.com/p/svgweb/
Adam
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com
--00504502d3bc466301047eb4dd5e--