Hello everyone! I'm here to introduce simple PHP picture watermark application methods
Notes should make clear
Thanksgiving
Notes should make clear
Thanksgiving
<?php
$org_img_path = 'test007.jpg';//Originally Picture path
$png_img_path = 'test007.png';// Watermark Picture path
$org_img_size = getImageSize($org_img_path);//load Originally Picture size info
$png_img_size = getImageSize($png_img_path);//load Watermark Picture size info
$org_img_x = 0;//Originally Picture put location X
$org_img_y = 0;//Originally Picture put location Y
$png_img_x = 0;// Watermark Picture put location X
$png_img_y = 0;// Watermark Picture put location Y
$org_img_w = $org_img_size[0];//Originally Picture width
$org_img_h = $org_img_size[1];//Originally Picture height
$png_img_w = $png_img_size[0];// Watermark Picture width
$png_img_h = $png_img_size[1];// Watermark Picture height
$org_img = imagecreatefromjpeg($org_img_path);//Originally Picture
$png_img = imagecreatefrompng($png_img_path);// Watermark Picture
//Combine Picture function,put $png_img Combine to $org_img
imagecopyresampled(
$org_img,//Originally Picture
$png_img,// Watermark Picture
$org_img_x,//Originally Picture put location X
$org_img_y,//Originally Picture put location Y
$png_img_x,// Watermark Picture put location X
$png_img_y,// Watermark Picture put location Y
$org_img_w,//Originally Picture width
$org_img_h,//Originally Picture height
$png_img_w,// Watermark Picture width
$png_img_h // Watermark Picture height
);
Header("Content-type: image/jpeg"); //Set the server to respond to Picture (important)
ImageJPEG($org_img);//make Picture
exit();
?>
Attach a sample file
test007.jpg

test007.png


Message Board
Feel free to leave suggestions and share! Thanksgiving!