How to use PHP & Write Logo/CopyRight to image (Watermark)
How to use PHP & Write Logo/CopyRight to image (Watermark) The guideline/example scripts how to using PHP and GD , Write Logo/CopyRight to image (Watermark)
Example
php_write_logo1.php
- <?php
- echo "<img src=MyResize/image.png>";
- $filname = "logo.gif";
- $src = ImageCreateFromGif($filname);
- $size = GetImageSize($filname);
- $im = ImageCreate(500, 450);
- $bg = ImageColorAllocate($im, 255, 255, 0);
- $color = ImageColorAllocate($im, 0, 0, 0);
- ImageCopy($im, $src, 140, 170, 0, 0, $size[0], $size[1]);
- ImagePng($im,"MyResize/image.png");
- ImageDestroy($src);
- ImageDestroy($im);
- ?>
Create a php file and save to path root-path/myphp/
Screenshot
php_write_logo2.php
- <?php
- echo "<img src=MyResize/image.png>";
- $myImage = imagecreatefromjpeg('mygirl.jpg');
- $myCopyright = imagecreatefromgif('logo.gif');
- $destWidth = imagesx($myImage);
- $destHeight = imagesy($myImage);
- $srcWidth = imagesx($myCopyright);
- $srcHeight = imagesy($myCopyright);
- $destX = ($destWidth - $srcWidth) / 2;
- $destY = ($destHeight - $srcHeight) / 1;
- $white = imagecolorexact($myCopyright, 255, 255, 255);
- imagecolortransparent($myCopyright, $white);
- imagecopymerge($myImage, $myCopyright, $destX, $destY, 0, 0, $srcWidth, $srcHeight, 50);
- imagejpeg($myImage,"MyResize/image.png");
- imagedestroy($myImage);
- imagedestroy($myCopyright);
- ?>
Create a php file and save to path root-path/myphp/
Screenshot
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment