Jump to content

How to make a dynamic signature (IP sig)


gamehead200

Recommended Posts

  • 3 weeks later...

  • 2 months later...

I've just tried following this tutorial and it hasn't completely worked.

At the moment I have the basic code with a few alterations for the font and what not, but all the page will display is the location of its self on my domain instead of an actual image.

Ive found one weird thing though, if i comment out / delete the "ImageTTFText($image, 8, 0, 10, 17, $white, $font, $text);" line, it will crete an image as its supposed to, but without the text. Also, when i view the page in IE (with the code there) it shows an error about the "ImageTTFText". I have tried a few things including altering the case of some things and a few file paths for the font, but it doesn't seem to be working.

Here is the current code:

<?php
Header ('Content-type: image/jpeg');
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');

$ip = $_SERVER['REMOTE_ADDR'];

$text = "Your IP address is $ip!";

// set the dimensions
$img_width = 240;
$img_height = 100;

// create the image
$image = imagecreate($img_width, $img_height);

// set the colours
$cool = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);
$grey = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue = imagecolorallocate($image, 0, 0, 255);

// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);

// set the font and print text
$font = '/usr/local/psa/home/vhosts/mydomain.co.uk/httpdocs/sig/ozhandin.ttf';

// now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down
ImageTTFText($image, 8, 0, 10, 17, $white, $font, $text);


// the above will display your IP address

// output and destroy
imagepng($image);
imagedestroy($image);

?>

EDIT:

Okay problem solved!. It turns out that making the file path for the font to just ozhandin.ttf cured it. I realy thoguht i'd tried every possibility. Guess not, and sorry for reviving, maybe this could serve as a reminder to check through everything more than 10 times :)

Edited by NutsAndyy
Link to comment
Share on other sites

  • 7 months later...
hey, i make something but all info is in one row! how to fix that?

and one more question.. any way for random font?

sry for English and thanks

Hi Futurist,

First off, welcome to MSFN! :)

To not make everything in one row, add \n where you want the row to end and everything will then appear on the row below it.

For a random font, remove this line:

$font = '/path/to/your/ttf/font/verdana.ttf';

And replace it with this piece of code:

$random_font = array('',
'/path/to/your/first/font.ttf',
'/path/to/your/second/font.ttf',
'/path/to/your/third/font.ttf',
'/path/to/your/fourth/font.ttf');

srand ((double) microtime() * 1000000);
$rnd = rand(1,count($random_font)-1);

$font = $random_font[$rnd];

Hope it works! If not, post back here with the error you get and/or a screenshot of what you're getting and I'll reply back.

Link to comment
Share on other sites

  • 4 weeks later...

Alright. I am not sure if you would do this for me but it would be highly appreciated. Could you put this xml file from this site ---> http://ladderslasher.d2jsp.org/xmlChar.php?i=92170 onto a dynamic signature? you seem to know what you are doing and i have been messing around with the code and a bunch of other sites and i just cant get it. I have already gone and deleted what i had because i had given up :realmad: . I the came to this forum and i thought i might ask. If this is possible please e-mail me at bballkid192837@aol.com :thumbup

http://ragnarok.lilfade.com/ls/shotkill.png/

This is an example of what i have been looking for. :thumbup

please send the PHP file to my email if you are able to do this.

Link to comment
Share on other sites

  • 4 weeks later...

hello, i have a question!

i have this code

<?php

Header ('Content-type: image/jpeg');

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');

// Dobij sliku

$slika_pret = $_GET['image'];

// Dobij ime

$ime_korisnika = $_GET['nick'];

// Napravi sliku koristenjem postojece pozdadine

$image = imagecreatefromjpeg($slika_pret);

// Format datuma

$date = date("F j. Y");

// Razlicit font

$random_font = array("",

"/font/Font1.ttf",

"/font/Font2.ttf",

"/font/Font3.ttf",

"/font/Font5.ttf");

srand ((double) microtime() * 1000000);

$rnd = rand(1,4);

// Odredi file u kojem su poruke

$quotes = file('quote.txt');

$quote = array_rand($quotes);

// Saznaj IP i hostame

$ip = $REMOTE_ADDR;

$resolved = gethostbyaddr ($REMOTE_ADDR);

// Provjeri IP

if ($resolved == $ip) {

$isp = "can't reslove IP";

}

else

{

$str = preg_split("/\./", $resolved);

$i = count($str);

$x = $i - 1;

$n = $i - 2;

$isp = $str[$n] . "." . $str[$x];

}

// Jednostavna detekcija operativnog sistema

$os = $HTTP_USER_AGENT;

$oslist = Array (

// Windows

"Win|Windows",

"Win16|Windows",

"Win95|Windows 95",

"Win98|Windows 98",

"WinME|Windows ME",

"Win32|Windows",

"WinNT|Windows NT",

"Windows 3.1|Windows 3.1",

"Windows 95|Windows 95",

"Windows CE|Windows CE",

"Windows 98|Windows 98",

"Windows ME|Windows ME",

"Windows NT|Windows NT",

"Windows NT 5.0|Windows 2000",

"Windows NT 5.1|Windows XP",

// Macintosh

"Mac_68000|MacOS m68K",

"Mac_68K|MacOS m68K",

"Mac_PowerPC|MacOS PPC",

"Mac_PPC|MacOS PPC",

"Macintosh|MacOS",

// Unices

"X11|UNIX",

"BSD|BSD",

"SunOS|SunOS",

"IRIX|IRIX",

"HP-UX|HP-UX",

"AIX|AIX",

"QNX|QNX",

"SCO_SV|SCO UNIX",

"FreeBSD|FreeBSD",

"NetBSD|NetBSD",

// Linux

"Linux|Linux",

"Debian|Debian GNU/Linux",

// Ostalo

"BeOS|BeOS",

"OS/2|OS/2",

"AmigaOS|AmigaOS",

);

foreach ($oslist as $osnow) {

$osnow = explode ("|", $osnow);

if (eregi ($osnow[0], $os)) {

$endos = $osnow[1];

$check = "No";

} elseif ($check != "No") {

$endos = "unknown";

}

}

/*

to output the OS, use $endos

to output the IP, use $ip

to output the resolved IP, use $resolved

to output the browser, use $browser

*/

// Tip preglednika

$agent = $HTTP_USER_AGENT;

if ( strstr($agent, "MSIE 5") ) $browser = "IE 5";

elseif ( strstr($agent, "MSIE 6") ) $browser = "IE 6";

elseif ( strstr($agent, "MSIE 4") ) $browser = "IE 4";

elseif ( strstr($agent, "Firebird") ) $browser = "Firebird";

elseif ( strstr($agent, "Safari") ) $browser = "Safari";

elseif ( strstr($agent, "Mozilla/5") ) $browser = "Mozilla FireFox";

elseif ( strstr($agent, "Mozilla/6") ) $browser = "Netscape 6";

elseif ( strstr($agent, "Mozilla/4") ) $browser = "Netscape 4";

elseif ( strstr($agent, "Opera") ) $browser = "Opera";

else $browser = "unknown";

$joke = wordwrap($quotes[$quote], 60, "\n", 1);

$joke = explode("\n", $joke);

// Boje

$cool = imagecolorallocate($image, 81, 86, 96);

$black = imagecolorallocate($image, 0, 0, 0);

$white = imagecolorallocate($image, 255, 255, 255);

$red = imagecolorallocate($image, 255, 0, 0);

$grey = imagecolorallocate($image, 204, 204, 204);

$green = imagecolorallocate($image, 206, 129, 18);

$blue = imagecolorallocate($image, 0, 0, 255);

// Font path na serveru

$font = $random_font[$rnd];

// Font za ime

$ime_font = $random_font[$rnd];

// IP adresa

ImageTTFText ($image, 11, 0, 10, 20, $white, $font, "Hey! Your IP is $ip,");

// Hostname

ImageTTFText ($image, 11, 0, 10, 40, $white, $font, "your hostname is $resolved,");

// Preglednik

ImageTTFText ($image, 11, 0, 10, 60, $white, $font, "you're using $browser,");

// Operativni sustav

ImageTTFText ($image, 11, 0, 10, 80, $white, $font, "on $endos OS,");

// Datum

ImageTTFText ($image, 11, 0, 10, 100, $white, $font, "today is $date");

// Ime

ImageTTFText ($image, 17, 0, 345, 80, $white, $ime_font, "$ime_korisnika");

// Poruka - Generator

for($i=0; $i<count($joke); $i++) {

ImageTTFText ($image, 10, 0, 10, 130, $white, $font, $joke[$i]);}

// Otvori i Unisti sliku

imagepng($image);

imagedestroy($image);

?>

how can I make to script resize image

with this

<?php

// Load image

$image = open_image('flower.jpg');

if ($image === false) { die ('Unable to open image'); }

// Get original width and height

$width = imagesx($image);

$height = imagesy($image);

// New width and height

$new_width = 150;

$new_height = 100;

// Resample

$image_resized = imagecreatetruecolor($new_width, $new_height);

imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

// Display resized image

header('Content-type: image/jpeg');

imagejpeg($image_resized);

die();

?>

Edited by Futurist
Link to comment
Share on other sites

Hi Everyone , I Just Want To Make A Dynamic Signature , But This Looks Too Advanced For Me ... I Have 10 Signatures In png. Format , And I Want Them To Be displayed Randomely When Changing Forum , Noticing That I Have No Knowledge In Php , And I Don't Have A Website ... So Could You Please Help Me ? Thank You !! :blushing:

Link to comment
Share on other sites

  • 10 months later...

For everyone's benefit, I have released my original "Jeremy" signature (i.e., the source code, graphics, etc.) under a GPL license. Use it as you wish. :) Grab it here!

My original post has been edited with this info.

Link to comment
Share on other sites

  • 1 month later...
For everyone's benefit, I have released my original "Jeremy" signature (i.e., the source code, graphics, etc.) under a GPL license. Use it as you wish. :) Grab it here!

My original post has been edited with this info.

Link is OFF, fix plsssssssssssssssssssss

Edited by gamehead200
Fixed link.
Link to comment
Share on other sites

For everyone's benefit, I have released my original "Jeremy" signature (i.e., the source code, graphics, etc.) under a GPL license. Use it as you wish. :) Grab it here!

My original post has been edited with this info.

Link is OFF, fix plsssssssssssssssssssss

Forgot to update it... Here is the new link (scroll down).
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...