php基础练习--图片加水印

php基础练习--图片加水印:

<?php 

    /**

    * addimage

    */



    $src_file = "./images/logo.jpg";

    $dst_file = "./images/gg.jpg";



    $src_im = imagecreatefromjpeg($src_file);

    $dst_im = imagecreatefromjpeg($dst_file);



    $src_w = imagesx($src_im);

    $src_h = imagesy($src_im); 



    imagecopy($dst_im, $src_im, 50, 50, 0, 0, $src_w, $src_h);



    header("content-type:image/jpeg");

    imagejpeg($dst_im);

        

        imagedestroy($dst_im);
View Code

核心:imagecopy(dst_im, src_im, dst_x, dst_y, src_x, src_y, src_w, src_h)函数。

你可能感兴趣的:(php基础)