watermark image php

Solutions on MaxInterview for watermark image php by the best coders in the world

showing results for - "watermark image php"
Till
16 May 2017
1			$targetFilePath='assets/images/targetimage.php';
2            file_put_contents($targetFilePath,$decoded);
3            
4            $watermarkImagePath = 'assets/images/watermark/watermark.png'; 
5            $watermarkImg = imagecreatefrompng($watermarkImagePath); 
6            $im = imagecreatefrompng($targetFilePath); 
7            
8            // Set the margins for the watermark 
9            $marge_right = 20; 
10            $marge_bottom = 20; 
11             
12            // Get the height/width of the watermark image 
13            $sx = imagesx($watermarkImg); 
14            $sy = imagesy($watermarkImg); 
15             
16            // Copy the watermark image onto our photo using the margin offsets and  
17            // the photo width to calculate the positioning of the watermark. 
18            imagecopy($im, $watermarkImg, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($watermarkImg), imagesy($watermarkImg)); 
19             
20            // Save image and free memory 
21            imagepng($im, $targetFilePath); 
22            imagedestroy($im);