为了账号安全,请及时绑定邮箱和手机立即绑定

将一张图像粘贴到另一张 PHP 中时出现问题

将一张图像粘贴到另一张 PHP 中时出现问题

PHP
ITMISS 2023-08-06 14:56:13
我想将 $original 图像粘贴到 $fondo 图像的中心,我编写以下代码:<?phpheader('Content-Type: image/png');// The file$fondo = imagecreate(1000,1000); // Create 1000x1000 image$color_fondo = imagecolorallocate($fondo,197,237,206); // Set color of background$original = imagecreatefromstring(file_get_contents('test.jpg')); // Load image$wb = imagesx($fondo); // Bakground width$wi = imagesx($original); // Image width$hb = imagesy($fondo);$hi = imagesy($original);//Want to center in the middle of the image, so calc ($wb/2-$wi/2)imagecopy($fondo,$original,($wb/2-$wi/2),($hb/2-$hi/2),0,0,imagesx($original),imagesy($original));imagepng($fondo);我得到的结果是这样的:正如您所看到的,青色正在影响原始图像:关于我错了什么有什么想法吗?谢谢你!
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 73 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信