php - 如何在 PHP 中创建图像

标签 php image

<分区>

是否可以使用 PHP 创建图像(而不是简单地通过 HTML 链接到它们),如果可以,我应该首先去哪里学习这种东西?

最佳答案

我更喜欢 GD library - 查看 the Examples , 这个例子:

<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(120, 20)
      or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>

输出:

imagecreatetrucolor example
(来源:php.net)

参见 imagecreatetruecolor .

关于php - 如何在 PHP 中创建图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25128/

相关文章:

php - Laravel 5.2 认证错误

PHP 5.3.5 fileinfo() MS Office 2007 文件的 MIME 类型 - magic.mime 更新?

python - 如何在 Python 中设置像素的 alpha 值

image - 使用 Tampermonkey 更改网站上的图像

php - 将数组的所有行插入MySql表 - Codeigniter相关

php - 数据库信息到Facebook Page Tab? XML 和 curl

php - 循环遍历数组时打印数组时出错

java - 仅包含图像的 ListView

使用 OpenCV 进行图像比较以确定交通密度

image - 使用 Matlab 将形状检测为圆形