bman3022 Posted November 24, 2003 Share Posted November 24, 2003 Thanks man I got it to workI had to edit it a little bit but it works now is there anyway to change the font size? Link to comment Share on other sites More sharing options...
gamehead200 Posted November 24, 2003 Share Posted November 24, 2003 Thanks man I got it to workI had to edit it a little bit but it works now is there anyway to change the font size?ImageTTFText ($image, 8, 0, 14, (23+($i*15)), $white, $font, $joke[$i]);Change the 8 to an even number...Can we see the final result? Link to comment Share on other sites More sharing options...
bman3022 Posted November 24, 2003 Share Posted November 24, 2003 im still working on it but here it iso and i have one little problem sometimes the qoute wraps on top of it self. any way to fix it?Have you found any thing on how to put the browser and os name ? Link to comment Share on other sites More sharing options...
gamehead200 Posted November 24, 2003 Share Posted November 24, 2003 im still working on it but here it iso and i have one little problem sometimes the qoute wraps on top of it self. any way to fix it?Have you found any thing on how to put the browser and os name ?The quote shouldn't wrap on itself... It should automatically go to the next line...No, I haven't found out yet... Link to comment Share on other sites More sharing options...
bman3022 Posted November 25, 2003 Share Posted November 25, 2003 well the qoutes not wrapping to the next lineHeres the code i used im i doing something wrong?<?phpheader ("Content-type: image/png");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');$image = imagecreatefromgif("bg.gif");$back_color = ImageColorAllocate ($image, 0, 5, 5);$white = ImageColorAllocate($im, 255, 255, 255);$ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );$quotes = file('quotes.txt');$quote = array_rand($quotes);$joke = wordwrap($quotes[$quote], 40, "\n", 1);$joke = explode("\n", $joke);ImageString ($image, 2, 12, 50, "You are $ip", $white);ImageString ($image, 2, 12, 70, "Your Running:", $white);ImageString ($image, 2, 12, 90, "$HTTP_USER_AGENT", $white);for($i=0; $i<count($joke); $i++) {ImageString ($image, 2, 12, 110, $joke[$i], $white);}Imagepng($image);imagedestroy($image);?> Link to comment Share on other sites More sharing options...
gamehead200 Posted November 25, 2003 Share Posted November 25, 2003 well the qoutes not wrapping to the next lineHeres the code i used im i doing something wrong?<?phpheader ("Content-type: image/png");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');$image = imagecreatefromgif("bg.gif");$back_color = ImageColorAllocate ($image, 0, 5, 5);$white = ImageColorAllocate($im, 255, 255, 255);$ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );$quotes = file('quotes.txt');$quote = array_rand($quotes);$joke = wordwrap($quotes[$quote], 40, "\n", 1);$joke = explode("\n", $joke);ImageString ($image, 2, 12, 50, "You are $ip", $white);ImageString ($image, 2, 12, 70, "Your Running:", $white);ImageString ($image, 2, 12, 90, "$HTTP_USER_AGENT", $white);for($i=0; $i<count($joke); $i++) {ImageString ($image, 2, 12, 110, $joke[$i], $white);}Imagepng($image);imagedestroy($image);?>Looks fine to me! Link to comment Share on other sites More sharing options...
tawxic Posted December 2, 2003 Share Posted December 2, 2003 howdy again...I have a question.. since we stopped using the imagettftext for text, and went on to imagestring.. maybe the option is available.. how do I center a text string? thanks Link to comment Share on other sites More sharing options...
Flynn Posted December 2, 2003 Share Posted December 2, 2003 I've tried including the OS and browser but it has never come out properly for me... I'll post it in here as soon as I find out...Well since this site was invaluable to me in figuring out how that signature image worked, here you go for OS and browser detection. This isn't my code but snips I located on the web in several places so I don't know who the original author is. It might not be perfect, but it's a really good start.Code removed due to a bug, new code with bugcatcher is a few post down Link to comment Share on other sites More sharing options...
un4given1 Posted December 2, 2003 Share Posted December 2, 2003 Flynn: your IP sig says... "Your ISP is: www.85.31" needless to say... that's wrong. just thought you should know. Link to comment Share on other sites More sharing options...
Flynn Posted December 2, 2003 Share Posted December 2, 2003 Flynn: your IP sig says... "Your ISP is: www.85.31" needless to say... that's wrong. just thought you should know.I guess then your IP isn't resolving and it's just ripping the last part of your IP Link to comment Share on other sites More sharing options...
Flynn Posted December 2, 2003 Share Posted December 2, 2003 Ok here is the code with a bug catcher to catch non-resolved IPs as un4given1 pointed out.$ip = The IP$isp = The domain you need to prefix it with "www."$endos = The OS // get IP and resolve IP$ip = $REMOTE_ADDR;$resolved = gethostbyaddr ($REMOTE_ADDR);// check for non resolve of IP and rip domain if resolvedif ($resolved == $ip) {$isp = ".. Can't Resolve IP";}else{$str = preg_split("/\./", $resolved);$i = count($str);$x = $i - 1;$n = $i - 2;$isp = $str[$n] . "." . $str[$x];}// Simple OS Detection$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",// Other "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";}} Link to comment Share on other sites More sharing options...
gamehead200 Posted December 2, 2003 Share Posted December 2, 2003 Thanks Flynn! Very useful! And welcome to MSFN! Link to comment Share on other sites More sharing options...
bman3022 Posted December 3, 2003 Share Posted December 3, 2003 **** i wish you had postted sonner i had to find out how to do it by asking the creator of the dansoft scriptOne question tho is there any way to make it say windows me?CAuse i use winme and it says im using windows 98 Link to comment Share on other sites More sharing options...
Flynn Posted December 3, 2003 Share Posted December 3, 2003 One question tho is there any way to make it say windows me?You know someone else pointed that out to me today I have no idea why the author of the code left out Me but it should be a simple fixAdd these two like line one each just under the 98 entries the resembleJust under "Win98|Windows 98", insert this"WinME|Windows ME",Just under "Windows 98|Windows 98", insert this"Windows ME|Windows ME",Report back if this works as I have never had a ME machine and the other person had yet to report back if the patch worked. Link to comment Share on other sites More sharing options...
tawxic Posted December 3, 2003 Share Posted December 3, 2003 what's wrong with this code? it just gives me the red x image box.<?phpheader ("Content-type: image/png");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');define("OFFSET", 0);define("YSECS", 365*24*60*60);define("DSECS", 24*60*60);define("HSECS", 60*60);define("MSECS", 60);function countdown($detail, $year, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) { $years = $days = $hours = $minutes = $seconds = 0; $now = mktime() + OFFSET*60*60; $then = mktime($hour, $minute, $second, $month, $day, $year); $cdown = abs($then - $now); if ($detail == 1) $years = round($cdown/YSECS); else $years = floor($cdown/YSECS); $cdown %= YSECS; if ($detail == 2) $days = round($cdown/DSECS); else $days = floor($cdown/DSECS); $cdown %= DSECS; if ($detail == 3) $hours = round($cdown/HSECS); else $hours = floor($cdown/HSECS); $cdown %= HSECS; if ($detail == 4) $minutes = round($cdown/MSECS); else $minutes = floor($cdown/MSECS); $cdown %= MSECS; $seconds = $cdown; $tnums = array($years, $days, $hours, $minutes, $seconds); $ttext = array("year", "day", "hour", "minute", "second"); $shown = 0; for ($i=0;$i<$detail;$i++) { if ($tnums[$i]) { echo "$tnums[$i] $ttext[$i]"; $shown++; if ($tnums[$i] != 1) echo "s"; $count = 0; for ($j=$i+1;$j<$detail;$j++) { if ($tnums[$j]) $count++; } switch($count) { case 0: break 2; case 1: if ($shown>1) echo ","; echo " and "; break; default: echo ", "; break; } } } if ($now > $then) echo " ago"; if ($now == $then) echo "now";}$tilxmas = countdown(2, 2003,12,25);$image = imagecreatefromgif("xmas.gif");$white = imagecolorallocate($image, 255, 255, 255);$font = "candycane.ttf";imagettftext ($image, 24, 0, 5, 5, $white, $font, $tilxmas);imagepng($image);imagedestroy($image);?>here's the image:Can't figure it out :-/ Link to comment Share on other sites More sharing options...
Recommended Posts