PHP (gdlib): text in images?

Desova

Limp Gawd
Joined
Jun 24, 2002
Messages
467
is there any way to get better text effects in php that this?
i've tried imagettftext() but i'm getting undefined function errors so i obviously dont have the right libraries on the server (i cant change that as just a bog standard hosting account)

1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
 
answer the man! lol. Im wondering the same thing. Also is their a way to input a little image instead of the text line?
 
PHP:
function watermark($filename) {
	$wm1img = imagecreatefrompng("images/wmbl.png");
	$wm2img = imagecreatefrompng("images/wmr.png");
	$wm1size = getimagesize("images/wmbl.png");
	$wm2size = getimagesize("images/wmr.png");
	$screenshot = imagecreatefromjpeg($filename);
	$screensize = getimagesize($filename);
	$w1 = $wm1size[0];
	$h1 = $wm1size[1];
	$w2 = $wm2size[0];
	$h2 = $wm2size[1];
	$sw = $screensize[0];
	$sh = $screensize[1];
	$dx1 = $sh - $h1 - 10;
	$dy1 = 10;
	$dy2 = $sw - $w2 - 10;
	$dx2 = ($sh - $h2)/2;
	$result = imagecopy($screenshot, $wm1img, $dy1, $dx1, 0, 0, $w1, $h1);
	$result = imagecopy($screenshot, $wm2img, $dy2, $dx2, 0, 0, $w2, $h2);
	imagejpeg($screenshot, $filename);
}
That's a function I made a while ago. It takes an image and puts two watermarks on top of it. You can use just the imagecopy() function to copy one image onto another. The parameters are:
imagecopy(image-to-copy-to, image-to-copy-from, destination-y-point, destination-x-point, source-y-point, source-x-point, source-width, source-height).

Mine says "copy $wm1img starting at point 0,0 (the entire source image) onto $screenshot to point $dx1, $dy1, with $wm1img having a width of $w1 and height $h1".

The only reason I have two imagecopy()'s is because the site I made that for had 2 watermark images, one for the bottom left corner, and one for the right side.
 
Back
Top