How to make a dynamic signature (IP sig)
#61
Posted 28 May 2007 - 10:41 AM
#62
Posted 13 June 2007 - 11:01 PM
#63
Posted 13 September 2007 - 02:23 PM
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
This post has been edited by NutsAndyy: 13 September 2007 - 02:46 PM
#64
Posted 25 April 2008 - 04:25 PM
and one more question.. any way for random font?
sry for English and thanks
#65
Posted 26 April 2008 - 05:20 PM
Futurist, on Apr 25 2008, 05:25 PM, said:
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.
#66
Posted 27 April 2008 - 02:45 PM
but how can i go to next row in random message?
i have
Test1
Test2
Test3
Test4, Test5
i want test5 in new row, possible?
#67
Posted 27 April 2008 - 02:57 PM
#68
Posted 01 May 2008 - 10:56 AM
anyone have newest list of OS? because when someone have vista, writes XP
#69
Posted 28 May 2008 - 02:52 PM
http://ragnarok.lilf...s/shotkill.png/
This is an example of what i have been looking for.
please send the PHP file to my email if you are able to do this.
#70
Posted 23 June 2008 - 10:45 AM
i have this code
Quote
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();
?>
This post has been edited by Futurist: 23 June 2008 - 10:46 AM
#71
Posted 25 June 2008 - 02:00 AM
#73
Posted 06 July 2009 - 05:47 PM
gamehead200, on May 19 2009, 09:04 AM, said:
My original post has been edited with this info.
Link is OFF, fix plsssssssssssssssssssss
This post has been edited by gamehead200: 06 July 2009 - 07:55 PM
Reason for edit: Fixed link.
#74
Posted 06 July 2009 - 07:50 PM
evandro, on Jul 6 2009, 07:47 PM, said:
gamehead200, on May 19 2009, 09:04 AM, said:
My original post has been edited with this info.
Link is OFF, fix plsssssssssssssssssssss
#75
Posted 07 July 2009 - 07:35 AM



Help

Back to top








