#39778 [Opn->Bgs]: NO IMG OUTPUT IF SOME ADDITIONAL SCRIPT BLOCK IS WRITTEN BEFORE THE IMG CODE
| From: | tony2001@php.net | Date: | Fri, 08 Dec 2006 16:29:27 +0000 |
| Subject: | #39778 [Opn->Bgs]: NO IMG OUTPUT IF SOME ADDITIONAL SCRIPT BLOCK IS WRITTEN BEFORE THE IMG CODE | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-106094@lists.php.net to get a copy of this message | ||
ID: 39778
Updated by: tony2001@php.net
Reported By: linuxtyh at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: *Graphics related
Operating System: Windows xp
PHP Version: 5.2.0
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2006-12-08 16:28:50] linuxtyh at gmail dot com
Description:
------------
IN MY CODE , there is an empty code block before the real useful code
block , the empty code block cause no img output in my server
Reproduce code:
---------------
<?php
///THIS BLOCK OF CODE CAN CAUSE NO IMG OUTPUT
// ÏÐÀ´ÎÞʱà´ËÒ»³Ì
// created by linuxtyh
// 08.12.2006 6:35:40 PM
//
?>
<?php
error_reporting(0);
$width=700;
$height=700;
$image = imagecreate($width, $height);
$bg = imagecolorallocate($image, 200, 200, 200);
$textcolor = imagecolorallocate($image, 0, 0, 255);
$linecolor = imagecolorallocate($image, 20, 100, 200);
if(!isset($_GET["function"])||$_GET["function"]=="")
{
imagestring($image, 5, 0, 0, "no function found.", $textcolor);
//echo("no func");
}
else
{
$function= $_GET["function"];
imagestring($image, 5, 0, 0, "function: y=$function ",
$textcolor);
//echo("found func");
$amp=30; //amplify
if( isset($_GET["amplify"]))
{ $amp= $_GET["amplify"];
}
$dx=0; //offset
$dy=0; //
$start=-$width/2;
$end=$width/2;
$function=str_replace ("x","((\$x)/$amp-$dx)" ,$function);
$function="\$y=$height/2-$amp*($function+$dy);" ;//+";";
$x=$start;
$y;
try{
eval($function);
}catch(Exception $error)
{
$y=1e20;
}
$oldx=$x;$oldy= $y ;
imageline($image, 0 , $height/2, $width , $height/2 ,
$linecolor);
imageline($image, $width /2 , 0, $width /2 , $height ,
$linecolor);
$ox=$width /2;$oy=$height/2;
for($i=0;$i<$width/2;$i+=1*$amp)
{
imageline($image, $width /2+$i , $height/2, $width /2+ $i
, $height/2-2 , $linecolor);
imagestring($image, 1, $width /2+$i , $height/2+2 , ""+$i/$amp
, $textcolor );
imageline($image, $width /2-$i , $height/2, $width /2- $i
, $height/2-2 , $linecolor);
imagestring($image, 1, $width /2-$i , $height/2+2 ,
""+(-$i)/$amp , $textcolor );
}
for($i=$amp;$i<$height/2;$i+=1*$amp)
{
imageline($image, $width /2 , $height/2+$i, $width /2+ 2
, $height/2+$i , $linecolor);
imagestring($image, 1,$width /2 +4 , $height/2+$i,
""+(-$i)/$amp , $textcolor );
imageline($image, $width /2 , $height/2-$i, $width /2+ 2
, $height/2-$i , $linecolor);
imagestring($image, 1,$width /2 +4 , $height/2-$i,
""+($i)/$amp , $textcolor );
}
for($x=$start; $x<=$end; $x++)
{
try{
eval($function);
}catch(Exception $error)
{
$y=1e20;
}
imageline($image, $oldx+$width/2 , $oldy, $x+$width/2 , $y
, $linecolor);
$oldx=$x;
$oldy=$y;
}
}
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
Expected result:
----------------
a math function image
Actual result:
--------------
no image output but an image of red cross
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39778&edit=1