For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > April 2005 > [GD] Troubles









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [GD] Troubles
sa

2005-04-24, 8:55 pm


Hi all,

i'm not able to explain the behaviour of browsers internet explorer and
mozilla firefox with that script:

<table width="680" height="400" align="center" border=1><tr><td>
<table border="0">
<?
for($j=0;$j<30;$j++)
{
echo "<tr align=\"top\">";
for($i=0;$i<60;$i++)
{
echo "<td><img src=\"gen_row.php?x2=0&y2=0&x1=0&y1=0\"></img></td>";
}
echo "</tr>";
}
?>

gen_row.php file draw lines

$x2 = $_GET["x2"];
$y2 = $_GET["y2"];
$x1 = $_GET["x1"];
$y1 = $_GET["y1"];
header("Content-type: image/png");
$im = @imagecreate(10, 10)
or die("Cannot Initialize new GD image stream");
$background = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imageline($im, $x2, $y2, $x1, $y1, $black);
imagepng($im);
imagedestroy($im);
?>

With internet explorer time to time it works, other time browser get mad and
neither find the file.
With firefox it seems to work but time to time it don't create all columns
and rows cause script terminate before the end.

Any help is apprecciated.

Salvatore


Kimmo Laine

2005-04-24, 8:55 pm

"sa" <sa1230usr@libero.it> kirjoitti
viestissä:xJ9ae.79229$zZ1.2198586@twister1.libero.it...
>
> Hi all,
>
> i'm not able to explain the behaviour of browsers internet explorer and
> mozilla firefox with that script:
>
> <table width="680" height="400" align="center" border=1><tr><td>
> <table border="0">
> <?
> for($j=0;$j<30;$j++)
> {
> echo "<tr align=\"top\">";
> for($i=0;$i<60;$i++)
> {
> echo "<td><img src=\"gen_row.php?x2=0&y2=0&x1=0&y1=0\"></img></td>";
> }
> echo "</tr>";
> }
> ?>
>
> gen_row.php file draw lines
>
> $x2 = $_GET["x2"];
> $y2 = $_GET["y2"];
> $x1 = $_GET["x1"];
> $y1 = $_GET["y1"];
> header("Content-type: image/png");
> $im = @imagecreate(10, 10)
> or die("Cannot Initialize new GD image stream");
> $background = imagecolorallocate($im, 255, 255, 255);
> $black = imagecolorallocate($im, 0, 0, 0);
> imageline($im, $x2, $y2, $x1, $y1, $black);
> imagepng($im);
> imagedestroy($im);
> ?>
>
> With internet explorer time to time it works, other time browser get mad
> and
> neither find the file.
> With firefox it seems to work but time to time it don't create all columns
> and rows cause script terminate before the end.
>
> Any help is apprecciated.
>



Don't know if this helps anything, but there's no closing tag </img> for
img.

--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears

eternal.erectionN0@5P4Mgmail.com


sa

2005-04-24, 8:55 pm

> Don't know if this helps anything, but there's no closing tag </img> for
> img.


I already tried closing </img> but its the same. I think could be something
what Oli Filth was saying..
i need to try.

Thank you all.


sa

2005-04-24, 8:55 pm

> 30 x 60 = 900. I dunno if this is the cause, but 900 simultaneous
> requests on a server is quite a serious load. Not to mention the
> rendering pressure this puts on the browser, and the fact that your HTML
> will be over 55K!


Ok, i must try reducing the numbers of rows/colums..lets try.

> What are you trying to achieve with this script?


Its a graph...every td can contain, "-" "/" - "\".




Oli Filth

2005-04-24, 8:55 pm

sa wrote:
>
>
> Ok, i must try reducing the numbers of rows/colums..lets try.
>
>
>
>
> Its a graph...every td can contain, "-" "/" - "\".
>


Can't you just generate the graph as a single image rather than 900
separate images?


--
Oli
sa

2005-04-24, 8:55 pm

> Can't you just generate the graph as a single image rather than 900
> separate images?


Thank you for the hint!
I'll try this way ->



Oli Filth

2005-04-25, 3:56 am

sa wrote:
> Hi all,
>
> i'm not able to explain the behaviour of browsers internet explorer and
> mozilla firefox with that script:
>
> <table width="680" height="400" align="center" border=1><tr><td>
> <table border="0">
> <?
> for($j=0;$j<30;$j++)
> {
> echo "<tr align=\"top\">";
> for($i=0;$i<60;$i++)
> {
> echo "<td><img src=\"gen_row.php?x2=0&y2=0&x1=0&y1=0\"></img></td>";
> }
> echo "</tr>";
> }
> ?>
>


30 x 60 = 900. I dunno if this is the cause, but 900 simultaneous
requests on a server is quite a serious load. Not to mention the
rendering pressure this puts on the browser, and the fact that your HTML
will be over 55K!

What are you trying to achieve with this script?


--
Oli
Oli Filth

2005-04-27, 3:56 am

sa wrote:
> Hi all,
>
> i'm not able to explain the behaviour of browsers internet explorer and
> mozilla firefox with that script:
>
> <table width="680" height="400" align="center" border=1><tr><td>
> <table border="0">
> <?
> for($j=0;$j<30;$j++)
> {
> echo "<tr align=\"top\">";
> for($i=0;$i<60;$i++)
> {
> echo "<td><img src=\"gen_row.php?x2=0&y2=0&x1=0&y1=0\"></img></td>";
> }
> echo "</tr>";
> }
> ?>
>


30 x 60 = 900. I dunno if this is the cause, but 900 simultaneous
requests on a server is quite a serious load. Not to mention the
rendering pressure this puts on the browser, and the fact that your HTML
will be over 55K!

What are you trying to achieve with this script?


--
Oli
Oli Filth

2005-04-27, 3:56 am

sa wrote:
>
>
> Ok, i must try reducing the numbers of rows/colums..lets try.
>
>
>
>
> Its a graph...every td can contain, "-" "/" - "\".
>


Can't you just generate the graph as a single image rather than 900
separate images?


--
Oli
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com