Home > Web Front-end > JS Tutorial > body text

PHP code to upload pictures and put transparent watermark on pictures_javascript skills

WBOY
Release: 2016-05-16 18:25:37
Original
1177 people have browsed it
Copy code The code is as follows:

$im = imagecreatefromjpeg($_file["upload"]["tmp_name "]); //You want to draw the picture of the water example
$watermark = imagecreatefrompng("Smiley.png"); //The path of the watermark image
$im_x = imagesx($im);
$ im_y = imagesy($im);
$w_x = imagesx($watermark);
$w_y = imagesy($watermark);
imagecopy($im,$watermark ,$im_x-$w_x,$ im_y-$w_y,0,0,$w_x,$w_y);
imagejpeg($im); //You can add a path to save the watermarked image
//You can use type to determine the image type
//switch($_file["upload"]["type"])
//case:1
//Then use different functions
//imagejpeg() to correspond to jpeg
//imagegif() corresponds to gif
//imagepng() corresponds to png
imagedestroy($im);
Related labels:
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