php多图片和文字合成最终图片

该PHP代码段用于将多张图片和文字合并到一张最终图片上,利用了GD库的图像处理功能,包括文字的添加和图片的合并。代码首先从数据库获取数据,然后调用两个函数分别完成文字合成和图片合成操作。
摘要由CSDN通过智能技术生成
<?php
	$id=$_GET['id'];
	$conn=mysql_connect("localhost","root","root");
	mysql_select_db("yx",$conn);
	mysql_query("set names utf8");
	$sql="select * from pigcms_lottery where id='$id'";
	$result=mysql_query($sql);
	$arr=mysql_fetch_assoc($result);
	//echo $arr['fist'];
	//echo $arr['second'];
	//echo $arr['third'];
	//echo $arr['four'];
	//echo $arr['five'];
	//echo $arr['six'];
	function hc1($content1,$content2,$content3,$content4,$content5,$content7){
		 /*打开图片*/  
		//1.配置图片路径  
		$src = "http://localhost/tpl/Wap/default/common/css/guajiang/images/bb.png";
		//2.获取图片信息  
		$info = getimagesize($src);  
		//3.通过编号获取图像类型  
		$type = image_type_to_extension($info[2],false);  
		//4.在内存中创建和图像类型一样的图像  
		$fun = "imagecreatefrom".$type;  
		//5.图片复制到内存  
		$image = $fun($src);  
		$background = imagecolorallocate($image, 255, 255, 255);                                                                  
		imagecolortransparent($image, $background);
		//imagealphablending($image, false);
		imagesavealpha($image, true);
		/*操作图片*/  
		//1.设置字体的路径  
		$font = "msyh.ttf";  
		//2.填写水印内容
		$size=15;  
		//$content1 = "";  
		//3.设置字体颜色和透明度  
		$color = imagecolorallocatealpha($i
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ougexingfuba

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值