已有83人关注
php绘图问题
发表在PHP答疑区 2017-05-02
是否精华
版块置顶:

帮忙看下哪里有错误

<?php
require '../../../../../public_file/database_connection.php';
$结果集=mysql_query("select * from 字符表");
$某行=mysql_fetch_array($结果集);
$a=$某行['字符大小'];
$b=$某行['字符角度'];
$c=$某行['字符横轴位置'];
$d=$某行['字符纵轴位置'];
$e=$某行['字体'];
$f=$某行['字符'];

$画布 = imagecreate(5120,4862);             
imagecolorallocate($画布, 255,255,255);
$前景颜色=imagecolorallocate($画布,0,0,0);


imagettftext($画布,$a,$b,$c,$d,$前景颜色,$e,$f);


header("content-type:image/png");   
imagepng($画布);      
imagedestroy($画布);  
?>

2017-05-02 08:30:47编辑
分享到:
精彩评论 5
慕容st
学分:6001 LV13
TA的每日心情
开心
2016-11-08 12:40:45
2017-05-02
沙发

读者您好:

可将运行之后的结果截图发上来,便于我们帮你分析和解决问题。

13723868561
学分:156 LV4
2017-05-02
板凳

慕容st 发表于2017-05-02 14:01

读者您好:

可将运行之后的结果截图发上来,便于我们帮你分析和解决问题。

火狐截图_2017-05-02T08-47-44.935Z.png


慕容st
学分:6001 LV13
TA的每日心情
开心
2016-11-08 12:40:45
2017-05-02
地板

$结果集=mysql_query("select * from 字符表");
$某行=mysql_fetch_array($结果集);


这部分的代码,从数据库查询完字符表之后,没有进行while循环吗?是否可将实际代码粘贴上来?

13723868561
学分:156 LV4
2017-05-02
4L

慕容st 发表于2017-05-02 18:27

$结果集=mysql_query("select * from 字符表");
$某行=mysql_fetch_array($结果集);


这部分的代码,从数据库查询完字符表之后,没有进行while循环吗?是否可将实际代码粘贴上来?

SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS  `zi_fu_biao`;
CREATE TABLE `zi_fu_biao` (
  `id` int(30) NOT NULL AUTO_INCREMENT,
  `zi_fu` varchar(1000) DEFAULT NULL COMMENT '字符',
  `zi_fu_da_xiao` int(11) DEFAULT NULL COMMENT '字符大小',
  `zi_fu_jiao_du` int(11) DEFAULT NULL COMMENT '字符角度',
  `zi_fu_heng_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符横轴位置',
  `zi_fu_zong_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符纵轴位置',
  `zi_ti` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '字体',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;

insert into `zi_fu_biao`(`id`,`zi_fu`,`zi_fu_da_xiao`,`zi_fu_jiao_du`,`zi_fu_heng_zhou_wei_zhi`,`zi_fu_zong_zhou_wei_zhi`,`zi_ti`) values
('7','abc','100','0','100','200','../../../../../../myfolder/Fonts/simfang.ttf'),
('8','vbn','80','0','120','250','../../../../../../myfolder/Fonts/simfang.ttf');
SET FOREIGN_KEY_CHECKS = 1;




<?php
require '../../../../../public_file/database_connection.php';
$jie_guo_ji=mysql_query("select * from zi_fu_biao");
$mou_hang=mysql_fetch_array($jie_guo_ji);

$a=$mou_hang['zi_fu_da_xiao'];
$b=$mou_hang['zi_fu_jiao_du'];
$c=$mou_hang['zi_fu_heng_zhou_wei_zhi'];
$d=$mou_hang['zi_fu_zong_zhou_wei_zhi'];
$e=$mou_hang['zi_ti'];
$f=$mou_hang['zi_fu'];


$hua_bu= imagecreate(5120,4862);             
imagecolorallocate($hua_bu, 255,255,255);
$qian_jing_yan_se=imagecolorallocate($hua_bu,0,0,0);

imagettftext($hua_bu,$a,$b,$c,$d,$qian_jing_yan_se,$e,$f);

header("content-type:image/png");   
imagepng($hua_bu);      
imagedestroy($hua_bu);  
?>


13723868561
学分:156 LV4
2017-05-02
5L

13723868561 发表于2017-05-02 20:15

SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS  `zi_fu_biao`;
CREATE TABLE `zi_fu_biao` (
  `id` int(30) NOT NULL AUTO_INCREMENT,
  `zi_fu` varchar(1000) DEFAULT NULL COMMENT '字符',
  `zi_fu_da_xiao` int(11) DEFAULT NULL COMMENT '字符大小',
  `zi_fu_jiao_du` int(11) DEFAULT NULL COMMENT '字符角度',
  `zi_fu_heng_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符横轴位置',
  `zi_fu_zong_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符纵轴位置',
  `zi_ti` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '字体',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;

insert into `zi_fu_biao`(`id`,`zi_fu`,`zi_fu_da_xiao`,`zi_fu_jiao_du`,`zi_fu_heng_zhou_wei_zhi`,`zi_fu_zong_zhou_wei_zhi`,`zi_ti`) values
('7','abc','100','0','100','200','../../../../../../myfolder/Fonts/simfang.ttf'),
('8','vbn','80','0','120','250','../../../../../../myfolder/Fonts/simfang.ttf');
SET FOREIGN_KEY_CHECKS = 1;




<?php
require '../../../../../public_file/database_connection.php';
$jie_guo_ji=mysql_query("select * from zi_fu_biao");
$mou_hang=mysql_fetch_array($jie_guo_ji);

$a=$mou_hang['zi_fu_da_xiao'];
$b=$mou_hang['zi_fu_jiao_du'];
$c=$mou_hang['zi_fu_heng_zhou_wei_zhi'];
$d=$mou_hang['zi_fu_zong_zhou_wei_zhi'];
$e=$mou_hang['zi_ti'];
$f=$mou_hang['zi_fu'];


$hua_bu= imagecreate(5120,4862);             
imagecolorallocate($hua_bu, 255,255,255);
$qian_jing_yan_se=imagecolorallocate($hua_bu,0,0,0);

imagettftext($hua_bu,$a,$b,$c,$d,$qian_jing_yan_se,$e,$f);

header("content-type:image/png");   
imagepng($hua_bu);      
imagedestroy($hua_bu);  
?>


我怀疑是数据引入,好像要使用$_GET[ ]
php gd函数不能与mysql一起使用


<?php    
require '../../../../../public_file/database_connection.php';
$结果集=mysql_query("select * from 字符表");
$某行=mysql_fetch_array($结果集);
$a=$某行['字符大小'];
$b=$某行['字符角度'];
$c=$某行['字符横轴位置'];
$d=$某行['字符纵轴位置'];
$e=$某行['字体'];
$f=$某行['字符'];
?>
<img src="cha_kan_xiao_guo2.php?字符大小=<?php echo $a ?>&字符角度=<?php echo $b ?>&字符横轴位置=<?php echo $c ?>&字符纵轴位置=<?php echo $d ?>&
字体=<?php echo $e ?>&
字符=<?php echo $f ?>"  alt=""/>



<?php    
$画布 = imagecreate(5120,4862);             
imagecolorallocate($画布, 255,255,255);
$前景颜色=imagecolorallocate($画布,0,0,0);  
$a=$_GET['字符大小'];
$b=$_GET['字符角度'];
$c=$_GET['字符横轴位置'];
$d=$_GET['字符纵轴位置'];
$e=$_GET['字体'];
$f=$_GET['字符'];
imagettftext($画布,$a,$b,$c,$d,$前景颜色,$e,$f);
header("content-type:image/png");   
imagepng($画布);      
imagedestroy($画布);  
?>



这两个文件合在一起可以运行


首页上一页 1 下一页尾页 5 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照