您好,欢迎访问一九零五行业门户网

php如何添加图片

php如何添加图片?php中插入图片的代码是什么?
php插入图片,实际还是输出html代码
比如:
echo '<img src='1.gir' width="100" height="100">';
还可以直接用php生成图片显示出来
php的gd库可以生成多种图像文件,如gif,png,jpg,wbmp,xpm等,下面来看一个生成正方形的文件。
<?php$height = 300;$width = 300;//创建背景图$im = imagecreatetruecolor($width, $height);//分配颜色$white = imagecolorallocate ($im, 255, 255, 255);$blue = imagecolorallocate ($im, 0, 0, 64);//绘制颜色至图像中imagefill($im, 0, 0, $blue);//绘制字符串:hello,phpimagestring($im, 10, 100, 120, 'hello,php', $white);//输出图像,定义头header ('content-type: image/png');//将图像发送至浏览器imagepng($im);//清除资源imagedestroy($im);?>
推荐:《php教程》
以上就是php如何添加图片的详细内容。
其它类似信息

推荐信息