PHP图像与相框合并
可能重复:PHP图像与相框合并,php,gd,Php,Gd,可能重复: 如何将相框和照片合并到相框上的特定位置?我有下面的代码,但它只是做奇怪的照片必须与帧一样大,以便合并它们。除了我所做的之外,还有什么解决方案或错误吗?非常感谢所有的回复 $image = imagecreatefromjpeg($me); $frame = imagecreatefrompng('HorizontalFrame.png'); imagealphablending($frame, true); imagesavealpha($frame, true); i
如何将相框和照片合并到相框上的特定位置?我有下面的代码,但它只是做奇怪的照片必须与帧一样大,以便合并它们。除了我所做的之外,还有什么解决方案或错误吗?非常感谢所有的回复
$image = imagecreatefromjpeg($me);
$frame = imagecreatefrompng('HorizontalFrame.png');
imagealphablending($frame, true);
imagesavealpha($frame, true);
imagecopy($image, $frame, 0, 0, 0, 0, 325, 276);
imagepng($image, 'image_4.png');
我通过更好的理解找到了正确的方法: 贷记人:DMin via 我使用CSS:
- 只需给HTML一个ID(例如字符、头发、武器)
- 然后使用value:absolute并将其映射到特定的x轴和y轴上
如果您使用PNG,那么您可以设置不可见的NH,这使它更像一个更酷的版本我认为您应该进一步研究imagecopy()是如何工作的,有什么推荐的方法吗?
$images = array( $_GET['color'], $_GET['face'], $_GET['hat'] );
// Allocate new image
$img = imagecreatetruecolor(58, 75);
// Make alpha channels work
imagealphablending($img, true);
imagesavealpha($img, true);
foreach($images as $fn) {
// Load image
$cur = imagecreatefrompng($fn);
imagealphablending($cur, true);
imagesavealpha($cur, true);
// Copy over image
imagecopy($img, $cur, 0, 0, 0, 0, 58, 75);
// Free memory
imagedestroy($cur);
}
header('Content-Type: image/png'); // Comment out this line to see PHP errors
imagepng($img);