PHP-Image processing

Source: Internet
Author: User
<?php

The first step is to set the file MIME type and change the output type to the image stream. Default is HTML if not set.
Header ("Content-type:image/png");

The second step creates a blank graphics area
$im = Imagecreatetruecolor (200,200);

The third step fills the background color for the area, and the first call to Imagecolorallocate () fills the color palette-based image with the background color
$blue = Imagecolorallocate ($im, 0,102,255);
Imagefill ($im, 0,0, $blue);

The fourth step is drawn on the background
$white = Imagecolorallocate ($im, 255,255,255);
Imageline ($im, 0,0,200,200, $white);
Imagestring ($im, 5,50,50, ' Hello world! ', $white);

Fifth Step output graphics
Imagepng ($im);

After the sixth step output image, destroy the image, release the memory
Imagedestroy ($im);

The seventh step calls the image on the other page



In the HTML page call:

Page display:


 

PHP-Image processing

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.