Use PHP code to generate images on web pages_PHP tutorial

WBOY
Release: 2016-07-13 09:48:06
Original
1116 people have browsed it

Use PHP code to generate images on web pages

This article mainly introduces the methods and examples of using PHP code to generate images on web pages. It is very simple and practical. If necessary, Friends can refer to it.

The code is very simple, no more nonsense here,

 ?

1

2

3

4

5

6

7

8

9

10

11

12

/**

* Created by PhpStorm.

* User: Administrator

* Date: 2015/6/29

* Time: 21:25

*/

header('Content-type:image/png');//设置mime type

$img = imagecreate(400,300);//设置图片像素

imagecolorallocate($img,255,255,255);//给图片上色

imageellipse($img,200,200,50,50,imagecolorallocate($img,255,0,0));//在图片上绘制图形,中心点200,200;宽高50,50

imagepng($img);//设置图片格式为PNG

1

2
3

4

5

6

8 9 10 11 12
/** * Created by PhpStorm. * User: Administrator * Date: 2015/6/29 * Time: 21:25 */ header('Content-type:image/png');//Set mime type $img = imagecreate(400,300);//Set image pixels imagecolorallocate($img,255,255,255);//Color the picture imageellipse($img,200,200,50,50,imagecolorallocate($img,255,0,0));//Draw graphics on the picture, center point 200,200; width and height 50,50 imagepng($img);//Set the image format to PNG
The effect is as follows: The above is the entire content of this article, I hope you all like it. http://www.bkjia.com/PHPjc/1025317.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1025317.htmlTechArticleUse PHP code to generate images on web pages. This article mainly introduces how to use PHP code to generate images on web pages. It is very simple and practical, and friends in need can refer to it. ...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!