Heim  >  Artikel  >  Backend-Entwicklung  >  php实例教程:使用php代码实现在网页上生成图片的步骤

php实例教程:使用php代码实现在网页上生成图片的步骤

WBOY
WBOYOriginal
2016-06-13 12:23:091297Durchsuche

php实例教程:使用php代码实现在网页上生成图片的方法

在php语言的网页中如何使用php代码实现在网页上生成图片呢?今天的php实例教程的主要内容是关于介绍了如何在网页上实现生成图片的简单方法,这是一个非常简单实用的php编程的技巧,感兴趣的朋友可以参考一下,相关的代码会为大家一一列举出来。
我们可以先看看效果图:
使用php代码实现在网页上生成图片的方法
此次的php学习代码很简单,测试代码如下:
  ?

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

?以上就是此次的php实例教程的学习,使用php代码就能简单实现在网页上生成图片,希望本文所述的内容对大家的php编程设计有所帮助。
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn