Questions about php image creation

Source: Internet
Author: User
Php image creation question // length and height $ _ width = 75; $ _ height = 25; // create an image $ _ img = imagecreatetruecolor ($ _ width, $ _ height); // white $ _ white = imagecolorallocate ($ _ img, 255,255,255); // fill in I php to create an image
// Length and height
$ _ Width = 75;
$ _ Height = 25;

// Create an image
$ _ Img = imagecreatetruecolor ($ _ width, $ _ height );

// White
$ _ White = imagecolorallocate ($ _ img, 255,255,255 );

// Fill
Imagefill ($ _ img, 0, 0, $ _ white );




// Output image
Header ('content-Type: image/png ');
Imagepng ($ _ img );

// Destroy
Imagedestroy ($ _ img );
In Firefox
The above code turns the background of the entire page Gray, and the image is in the middle. However, the tutorial I read is normal, and other browsers are also normal.

------ Solution --------------------
That's the problem with the browser.
------ Solution --------------------
You can use php to save the image as a file and use Firefox to open it. You will know if it is a browser issue.
------ Solution --------------------
I remember, it seems that Firefox displays images in this way. put them in the middle. your images are generated correctly.

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.