web 2.0

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)

ShotDev Focus:
- PHP & 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/

Run
http://localhost/myphp/php_write_logo1.php

Screenshot

PHP & Write Logo/CopyRight to image (Watermark)

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/

Run
http://localhost/myphp/php_write_logo2.php

Screenshot

PHP & Write Logo/CopyRight to image (Watermark)

.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

One Response to “How to use PHP & Write Logo/CopyRight to image (Watermark)”

  1. 3practice…

Leave a Reply

You must be logged in to post a comment.