FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


php signature genarator





mahirharoon
the php signer used in my sig
A.file folders note
1.make a folder with any name you want but should end with .png (otherwise it won't work because the forum software will not allow)
2.should be chmodded 777
B.the code
1.index.php
Quote:
<?php
//the header
header("Content-type: image/png");
//define variables
//create image
$im = imagecreate(315, 15);
//background color
$bg = imagecolorallocate($im, 255, 255, 255);
//textcolor
$textcolor = imagecolorallocate($im, 0, 0, 0);
//enter text in image
imagestring($im, 3, 0, 0, "DiGiTaLlY Signed by Mahir using <?php> powers", $textcolor);
//show the image
imagepng($im);
?>

C.notes
1.text in dark red is your username
2.text in dark blue is the size of the image
3.text in indigo is the hex of the text color
D.preview
mtorregiani
Great tutorial man, thanks for sharing.
I knew of something like this before, it was for dynamic images...
mahirharoon
mtorregiani wrote:
Great tutorial man, thanks for sharing.
I knew of something like this before, it was for dynamic images...

can you give a link
Star Wars Fanatic
Not to bad, but use quote tags, not code tags.

I myself have coded a signature system for pulling information from a MMORPGs highscores and displaying it in a nice image.
While my code is kinda slow, it does get the job done, and I'm working on a recode right now.
mahirharoon
ok , thanks
mahirharoon
i will update the preview because i deleted my frih acount
jsfdan
Thanks for sharing. I will dabble with this, tonight!
mtorregiani
mahirharoon wrote:
mtorregiani wrote:
Great tutorial man, thanks for sharing.
I knew of something like this before, it was for dynamic images...

can you give a link


I know that this is probably too old... but, here's it.

Quote:
STEP 1: Customize the index.php. Change the urls of the images and add more if you want. (If you add more, remember to change $randnum = rand(0,3); )

STEP 2: Create a directory called image.png in your site preferably under the public_html directory.

STEP 3: Put the index.php in that sig.png directory

URL will be www.yoursite.com/image.png
In the image I have given /image.png assuming the directory will be under public_html

For eg if it is in another directory give the respective path
e.g. www.yoursite.com/images/sig.png


here's the index.php source.

Code:

<?php
Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
Header("Pragma: no-cache");
Header("Content-Type: image/gif");

srand((double)microtime()*1000000);
$randnum = rand(0,3);
if($randnum == 0)
{
 readfile("url-image_1");
}
else if($randnum == 1)
{
 readfile("url-image_2");
}
else if($randnum == 2)
{
 readfile("url-image_3");
}
else if($randnum == 3)
{


Enjoy it!
rede22
Thank you for sharing the tutorial, very helpful ..

mahirharoon wrote:
the php signer used in my sig
A.file folders note
1.make a folder with any name you want but should end with .png (otherwise it won't work because the forum software will not allow)
2.should be chmodded 777
B.the code
1.index.php
Quote:
<?php
//the header
header("Content-type: image/png");
//define variables
//create image
$im = imagecreate(315, 15);
//background color
$bg = imagecolorallocate($im, 255, 255, 255);
//textcolor
$textcolor = imagecolorallocate($im, 0, 0, 0);
//enter text in image
imagestring($im, 3, 0, 0, "DiGiTaLlY Signed by Mahir using <?php> powers", $textcolor);
//show the image
imagepng($im);
?>

C.notes
1.text in dark red is your username
2.text in dark blue is the size of the image
3.text in indigo is the hex of the text color
D.preview
Kunkstar7
This is pretty cool, but would it be easy to modify this so that different images would be shown?
pashmina
Code:
<?php
//the header
header("Content-type: image/png");
//define variables
//create image
$im = imagecreate(315, 15);
//background color
$bg = imagecolorallocate($im, 255, 255, 255);
//textcolor
$textcolor = imagecolorallocate($im, 0, 0, 0);
//enter text in image
imagestring($im, 3, 0, 0, "DiGiTaLlY Signed by Mahir using <?php> powers", $textcolor);
//show the image
imagepng($im);
?>


ok can you explain this code to me

Code:
imagestring($im, 3, 0, 0, "DiGiTaLlY Signed by Mahir using <?php> powers", $textcolor);
Star Wars Fanatic
pashmina wrote:
Code:
<?php
//the header
header("Content-type: image/png");
//define variables
//create image
$im = imagecreate(315, 15);
//background color
$bg = imagecolorallocate($im, 255, 255, 255);
//textcolor
$textcolor = imagecolorallocate($im, 0, 0, 0);
//enter text in image
imagestring($im, 3, 0, 0, "DiGiTaLlY Signed by Mahir using <?php> powers", $textcolor);
//show the image
imagepng($im);
?>


ok can you explain this code to me

Code:
imagestring($im, 3, 0, 0, "DiGiTaLlY Signed by Mahir using <?php> powers", $textcolor);


The function imagestring writes a string to the image. Basically he is putting his name down as a signature. The variables given to the function are:
Code:
bool imagestring  ( resource $image  , int $font  , int $x  , int $y  , string $string  , int $color  )

Taken from http://us.php.net/manual/en/function.imagestring.php

On the image would appear this text:
"DiGiTaLlY Signed by Mahir using <?php> powers"

If you change the text, that line will change ion the image.
jsfdan
Aha, so this is what I was looking for. Thanks man! Smile
riccopt
that is really nice... I used to play with GEO IP... it was really fun to write the name of the cities on the images when the visitors were on my site...
the_one111
Nice tutorial - I just recently started working with PHP GD, and there's certainly a lot of things to do.

Also, if you want to change the background image based on a variable in the image URL, it can be done as so:

Just replace the "$im = imagecreate(315, 15);" line with:
Code:


if ($_GET["type"] == 1) {
$im = imagecreatefrompng("my_first_image.png");
}
else if ($_GET["type"] == 2) {
$im = imagecreatefrompng("my_second_image.png");
}
else  {
$im = imagecreatefrompng("my_third_image.png");
}


So while the URL image.php will result in the image being created from "my_third_image.png", you can use the URL of image.php?type=1 to display "my_first_image.png".
Related topics
PHP-Nuke platium?
Arghulge La PHP NOT BEING COOL Ciazio Eh Turshishishty.
Dynamic PHP Images
is banner display in Signature allowed?
[RESOLVED] How to add image or text to link in signature?
php image exif functions
What is NUKE php?
[GUIDE] How to create a dynamic signature?
[PHP] mt_rand or rand?
A PHP Script Contest, winner get 100F$
Need a forum signature script, (php functions req)
Need PHP Coder
Looking for Dynamic Signature made for #Frih on Dal.Net
MAKE MONEY ONLINE กกกกก
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.