Home > Backend Development > PHP Tutorial > 生手PHP画图 imagecreateformjpeg和imagecreate区别是啥

生手PHP画图 imagecreateformjpeg和imagecreate区别是啥

WBOY
Release: 2016-06-13 12:47:07
Original
968 people have browsed it

新手PHP画图 imagecreateformjpeg和imagecreate区别是啥?
header("content-type:image/gif");        //定义输出为图像类型
$im=imagecreatefromjpeg("bg.jpg");  //载入照片
$textcolor=imagecolorallocate($im,56,73,136);   //设置字体颜色为蓝色,值为RGB颜色值
$fnt="c:/windows/fonts/simhei.ttf";     //定义字体
$text =iconv("gb2312", "utf-8", "丹东断桥");              //将中文转换为UTF-8格式
imageTTFText($im,30,0,150,120,$textcolor,$fnt,$text);     //写TTF文字到图中
imagegif($im);       //建立gif图形
imageDestroy($im);      //结束图形,释放内存空间
?>

上例中,我把
$im=imagecreatefromjpeg("bg.jpg");  //载入照片
换成
$im=imagecreate(200, 100);
就出错了。为什么呀?我只是想把背景图片换成自己定义的方框。

PHP 图形
Related labels:
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