Need GD function

Here non-phpBB topics can be discussed.
User avatar
sanis
New member
New member
Posts: 21
Joined: 26 Sep 2006, 17:00
Location: Lithuania / Kaunas / Romaniai

Need GD function

Postby sanis » 07 Oct 2006, 16:56

I need GD function how to add image on image ;P because i am going to make a huge smile and sig generator site :) any ideas how to add image on image? :money:

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor

Postby igorw » 07 Oct 2006, 17:07

This is a script i made once. I hope it helps you ;)

[php]<?php

// Set size
$sizex = '200';
$sizey = '30';

// Set positions
$posx = '10';
$posy = '29';

$text = $_SERVER['REMOTE_ADDR'];

$fonts_path = './fonts/'

// Replace path by your own font path
//$font = $counter_root . 'fonts/TRASHED.ttf';
$font = $fonts_path . 'UnrealT.ttf';


// Output

// Set the content-type
header('Content-type: image/png');

// Create the image
$im = imagecreatetruecolor($sizex, $sizey);

// Decrement sizes
$sizex--;
$sizey--;

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, $sizex, $sizey, $white);

// Add some shadow to the text
//imagettftext($im, 20, 0, $posx+1, $posy+1, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, $posx, $posy, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);


?>[/php]

User avatar
Noobarmy
Past Contributor
Past Contributor
Posts: 545
Joined: 02 Jun 2006, 11:19
Real name: Anthony Chu
Location: UK

Postby Noobarmy » 07 Oct 2006, 17:08

[url=http://uk2.php.net/manual/he/function.imagecopymerge.php]ImageCopyMerge[/url] :)
Image

User avatar
sanis
New member
New member
Posts: 21
Joined: 26 Sep 2006, 17:00
Location: Lithuania / Kaunas / Romaniai

Postby sanis » 07 Oct 2006, 18:01

Thanks again :) lets start this project :)


Return to “General Discussion”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 17 guests