The imagecreate () code in the gd class library is as follows: & lt ;? Php // header (& quot; content-type: image/png & quot;); include (& quot; config. php & quot;); $ s1 = & quot; SELECT * FROMquestionWHER about imagecreate () in the gd class library ()
The code is as follows:
// Header ("content-type: image/png ");
Include ("config. php ");
$ S1 = "SELECT * FROM question WHERE t = 0 ";
$ Result = mysql_query ($ s1 );
$ I = 0;
While ($ row = mysql_fetch_array ($ result ))
{
$ Id = $ row ["id"];
$ Content0 = $ row ["content"];
$ S2 = "SELECT * FROM question WHERE t = '$ ID '";
$ Result1 = mysql_query ($ s2 );
Echo"
";Echo"
| ". $ Content0 ." |
";While ($ rows = mysql_fetch_array ($ result1 )){$ Content = $ rows ["content"];$ Num = $ rows ["num"] * 10;$ Im = imagecreate ($ num, 20 );$ Black = imagecolorallocate ($ im, rand (0,254), rand (0,255), rand (0,255 ));$ Name = $ I;Imagepng ($ im, "E: \ apache \ htdocs \ image \ Logs ");Echo"
| ". $ Content ." | ";Echo"
| ";Echo"
". ($ Num/10 )." |
";Imagedestroy ($ im );$ I ++;}Echo"
";
}
?>
When imagecreate is placed in a loop, the following error occurs: Warning: imagecreate () [function. imagecreate]: Invalid image dimensions.
Why is the output image a single image?
------ Solution --------------------
Warning: imagecreate () [function. imagecreate]: Invalid image dimensions: Invalid image size
Description: $ num = $ rows ["num"] * 10. here, $ rows ["num"] may be an empty string value. As for why it is null, it depends on your table design.
------ Solution --------------------
You fooled me.
Echo"";
OnlyThis is the result!
You need
Echo"";
To get