Home > Backend Development > PHP Tutorial > PHP transparent watermark generation code_PHP tutorial

PHP transparent watermark generation code_PHP tutorial

WBOY
Release: 2016-07-21 15:16:27
Original
964 people have browsed it

Copy code The code is as follows:

/*
* Created on 2010-10-27
* BY QQ542900563
* Copyrights Reserved 2000-2020
* This example demonstrates how to generate image watermarks
*/
//Load two images respectively
$im=imagecreatefromjpeg( "liu.jpg");
$img2=imagecreatefrompng("m.png");

//Get the length and width of each and calculate the position
$im_WH=getimagesize("liu.jpg ");
$im_W=$im_WH[0];
$im_H=$im_WH[1];

$img2_WH=getimagesize("m.png");
$img2_W =$img2_WH[0];
$img2_H=$img2_WH[1];

//Define the storage location
$NewX=$im_W-$img2_W;
$NewY=$ im_H-$img2_H;

//Filling
imagecopy($im,$img2,$NewX,$NewY,0,0,$img2_W,$img2_H);

header( "Content-type:image/jpeg");
imagejpeg($im);

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325917.htmlTechArticleCopy the code as follows: ?php /* * Created on 2010-10-27 * BY QQ542900563 * Copyrights Reserved 2000 -2020 * This example demonstrates how to generate image watermarks*/ //Load two images respectively...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template