php 给图片加水印

<?php
    water('upload/images/202007250204199.jpg', 'upload/images/202007250155160.jpg');
    
    function water($durl, $surl) {
        $dit = imagecreatefromjpeg($durl);
        $src = imagecreatefromjpeg($surl);
        
        list($dw, $dh) = getimagesize($durl);
        list($sw, $sh) = getimagesize($surl);
        
        $result = imagecopymerge($dit, $src, ($dw - $sw) / 2, $dh - $sh - 100, 0, 0, $sw, $sh, 100);
        
        header('Content-type:image/jpeg');
        imagejpeg($dit, NULL, 100);
        
        imagedestroy($dit);
        imagedestroy($src);
    }
?>

猜你喜欢

转载自www.cnblogs.com/qiuxd/p/13376566.html