Php drawing problems

Source: Internet
Author: User
Php plotting & lt ;? Phpheader ("content-type: image/png"); $ img & nbsp; = & nbsp; imagecreate (85, & nbsp; 27); imagecolorallocatealpha ($ img, & nbsp; 127, & n php drawing problems
 header("content-type:image/png");
$img = imagecreate(85, 27);
imagecolorallocatealpha($img, 127, 127, 127, 0);
imagepng($img);
//imagedestroy($img);
?>


The result is a cross. ask the answer. what is the problem.
------ Best solution --------------------
Add
Error_reporting (E_ALL &~ (E_STRICT
------ Other solutions --------------------
I found that I can see a gray rectangle here. it's not that your gd library is not open.
------ Other solutions --------------------
In addition to the code you have posted, this php file cannot contain any other code. Otherwise, an error occurs.
Because the final HTML code format is:

------ Other solutions --------------------
Reference:
In addition to the code you have posted, this php file cannot contain any other code. Otherwise, an error occurs.
Because the final HTML code format is:


The whole page only has the above code. Nothing else can be displayed in a file.
------ Other solutions --------------------
Reference:
I found that I can see a gray rectangle here. it's not that your gd library is not open.


I don't know. I can only save it and cannot directly output it to the page. You can show that I have not tried WINIDOW in LINUX. what about you?
------ Other solutions --------------------
The encoding of the file. Removed the BOM header.
------ Other solutions --------------------
Reference:
The encoding of the file. Removed the BOM header.

UTF-8 coding,
------ Other solutions --------------------
Confirm that there is no BOM header. use the editor to save it in UTF-8 without bom format.
------ Other solutions --------------------
Reference:
Confirm that there is no BOM header. use the editor to save it in UTF-8 without bom format.


I keep saving it like this.
------ Other solutions --------------------

Yes?> Try again
------ Other solutions --------------------
E_NOTICE ));

Check whether an error is reported? Is the GD Library not enabled?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.