How to using PHP and GD library write text in image/picture.(Water mark on Images)
How to use PHP & Write Text in image The guideline/example scripts how to using PHP and GD library write text in image/picture.
ShotDev Focus:
- PHP & GD Library (Write Text in Image/Picture)
- PHP & GD Library (Write Text in Image/Picture)
Example 1 (Open picture and write text)
- <?
- echo "<img src=MyResize/mygirl.png>";
- $string = "Narak Girl By ShotDev.Com"; // String
- $im = ImageCreateFromJpeg("mygirl.jpg"); // Path Images
- $color = ImageColorAllocate($im, 255, 0, 0); // Text Color
- $pxX = (Imagesx($im) - 6.5 * strlen($string))/2; // X
- $pxY = Imagesy($im)- 20; // Y
- ImageString($im, 200, $pxX, $pxY, $string, $color);
- imagePng($im,"MyResize/mygirl.png");
- ImageDestroy($im);
- ?>
Example 2 (Using Font)
- <?
- echo "<img src=MyResize/mygirl.png>";
- $font = 'ANGSAZ.TTF';
- $string = "Narak Girl By ShotDev.Com"; // String
- $im = ImageCreateFromJpeg("mygirl.jpg"); // Path Images
- $color = ImageColorAllocate($im, 255, 0, 0); // Text Color
- $pxX = (Imagesx($im) - 4 * strlen($string))/2; // X
- $pxY = Imagesy($im)- 10; // Y
- ImagettfText($im, 20, 0, $pxX, $pxY, $color, $font, $string);
- imagePng($im,"MyResize/mygirl.png");
- ImageDestroy($im);
- ?>
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment