imagecopymerge() copy và blend (phối trộn) một vùng từ ảnh nguồn vào ảnh đích với độ trong suốt.
Cú pháp
imagecopymerge(resource $dst, resource $src, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool
Tham số
- pct: Phần trăm blend (0-100). 0 = hoàn toàn trong suốt (không thấy src), 100 = che hoàn toàn (giống imagecopy).
Ví dụ: Gộp 2 logo với 60% opacity
<?php
$dest = imagecreatefrompng('https://example.com/js.png');
$src = imagecreatefrompng('https://example.com/java.png');
imagecopymerge($dest, $src, 10, 10, 0, 0, 350, 120, 60);
header('Content-Type: image/png');
imagegif($dest);
imagedestroy($dest); imagedestroy($src);
?>