|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-12-08 16:29 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 03:00:01 2025 UTC |
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