Logo of the website
Logo of the website
I would like to know how to make that immage on the corners of pics like "this immage is hosted at:::::" how does it work because i am sure that they do not put that manualy on every pic...
A funny picture -------> me , myself and i (too much for this world)
-
- Posts: 479
- Joined: Tue May 16, 2006 11:53 am
Re: Logo of the website
Iframes, overlays, some scripts can embed watermark logo on the fly...try googleKaky wrote:I would like to know how to make that immage on the corners of pics like "this immage is hosted at:::::" how does it work because i am sure that they do not put that manualy on every pic...
-
- Posts: 36
- Joined: Mon Jul 04, 2005 8:37 pm
i have a script for automatic images watermarking [features: image or text as a watermark in various image places- corners, center and so on...]. I've found it but didnt tested yet. It uses GD library, so i hope were will not be any problems with various hosts. If you realy need that, PM me and i'll search in my huge scripts collection and will send you to your mail
GD Library
You can use this code: I built it using the info at php.net
header("Content-type: image/png"); this is the mime type of the image. You can change it to image/jpeg, image/gif etc.
$string = $_GET['text']; this is the text that goes on. It uses a $_GET (the index.php?text=hello kind of thing), but you can change it to what ever text you want to output
$im = imagecreatefrompng("images/button1.png"); this is the path to the image. You can change imagecreatefrompng to imagecreate if you aren't using a png. You have to change the uri to a width followed by a height if you do
$orange = ****($im, 220, 210, 60); this is the text colour. you change it using the RGB values (220, 210, 60).
$px = (imagesx($im) - 7.5 * strlen($string)) / 2; This finds the width of the given image, then halves it to centre the text. You can use a pixel value for the text location if you want: uses 5 pixels
imagestring($im, 3, $px, 9, $string, $orange); this creates the image, using
imagepng($im); this outputs the image if it is a png. You could also use imagejpeg($im);, imagegif($im);, imagewbmp($im); etc.
imagedestroy($im); clears the image variable.
Hope that helps
Daniel
Code: Select all
<?php
header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("images/button1.png");
$orange = ****($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
header("Content-type: image/png"); this is the mime type of the image. You can change it to image/jpeg, image/gif etc.
$string = $_GET['text']; this is the text that goes on. It uses a $_GET (the index.php?text=hello kind of thing), but you can change it to what ever text you want to output
$im = imagecreatefrompng("images/button1.png"); this is the path to the image. You can change imagecreatefrompng to imagecreate if you aren't using a png. You have to change the uri to a width followed by a height if you do
Code: Select all
$im = imagecreate(100, 30);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2; This finds the width of the given image, then halves it to centre the text. You can use a pixel value for the text location if you want:
Code: Select all
$px = 5;
imagestring($im, 3, $px, 9, $string, $orange); this creates the image, using
- $im the original image
- 3 PHP built in font 3
- $px the number of pixels across horizontally
- 9 9 pixels from the top
- $string the text string
- $orange the font colour
imagepng($im); this outputs the image if it is a png. You could also use imagejpeg($im);, imagegif($im);, imagewbmp($im); etc.
imagedestroy($im); clears the image variable.
Hope that helps
Daniel
-
- Posts: 105
- Joined: Wed Jul 26, 2006 9:16 am