php gd png透明,php – GD图像叠加透明png

搜索热词

我有透明的图像,我想覆盖整个图像,以赋予它更大的效果.在此代码中,它会裁剪现有图像.它合并了两个,但最后的顶部没有显示alpha.我怎样才能解决这个问题?

$dst_x = 0; // X-coordinate of destination point.

$dst_y = 0; // Y --coordinate of destination point.

$src_x = 163; // Crop Start X position in original image

$src_y = 0; // Crop Srart Y position in original image

$dst_w = 469; // Thumb width

$dst_h = 296; // Thumb height

$src_w = 469; // $src_x + $dst_w Crop end X position in original image

$src_h = 296; // $src_y + $dst_h Crop end Y position in original image

// Creating an image with true colors having thumb dimensions.( to merge with the original image )

$dst_image = imagecreatetruecolor($dst_w,$dst_h);

// Get original image

$src_image = imagecreatefromjpeg("http://www.ucatholic.com/wp-content/uploads/2012/10/Sallixtus-631x295.jpg");

// Cropping

imagecopyresampled($dst_image,$src_image,$dst_x,$dst_y,$src_x,$src_y,$dst_w,$dst_h,$src_w,$src_h);

// Saving

imagejpeg($dst_image,"images/crop.jpg");

$src = imagecreatefrompng('http://www.EdVizenor.com/images/saintCover.png');

/// THIS LINE NOT WORKING - - // Copy and merge

imagecopymerge($dst_image,$src,469,296,100);

header('Content-Type: image/png');

imagegif($dst_image);

?>

不要使用imagecopymerge,使用imagecopy,然后它将正常工作,你的水印将显示alpha.

imagecopy($dst_image,296);

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值