Steve Scrimpshire Posted September 17, 2003 Report Share Posted September 17, 2003 I posted this: http://mandrakeusers.org/viewtopic.php?t=2...namic+signature when I was running 8.1, now I'm running 9.1 and this script does not work. It just gives me: "The image http://squirrelmessiah.no-ip/signature.png could not be displayed because it contains errors" Any ideas? Here's the script again: <?php header ("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"); $ut = strtok( exec("uptime"), "." ); $days = sprintf( "%2d", ($ut/(3600*24)) ); $hours = sprintf( "%2d", ( ($ut % (3600*24))/3600) ); $min = sprintf( "%2d", ($ut % (3600*24) % 3600)/60 ); $days = trim($days); $hours= trim($hours); $min = trim($min); $img = @ImageCreate(245,60); $recorduptime= "uptimebest"; $fp2 = isset($fp2) ? $fp2 : fopen("$recorduptime",'r'); $fp2=fopen("$recorduptime",'r'); flock ($fp2,1); $best= fread ($fp2, filesize ($recorduptime)); flock($fp2,3); fclose($fp2); $record = explode("|",$best); if ($days > $record[0]){ $fp2=fopen("$recorduptime",'w'); flock ($fp2,2); fwrite($fp2,"$days|$hours|$min"); flock($fp2,3); fclose($fp2); } if ($days == $record[0]){ if ($hours > $record[1]){ $fp2=fopen("$recorduptime",'w'); flock ($fp2,2); fwrite($fp2,"$days|$hours|$min"); flock($fp2,3); fclose($fp2); } if ($hours == $record[1]){ if ($min >= $record[2]){ $fp2=fopen("$recorduptime",'w'); flock ($fp2,2); fwrite($fp2,"$days|$hours|$min"); flock($fp2,3); fclose($fp2); } } } $fp2=fopen("$recorduptime",'r'); flock ($fp2,1); $best= fread ($fp2, filesize ($recorduptime)); flock($fp2,3); fclose($fp2); $record = explode("|",$best); $bg = ImageColorAllocate($img, 211, 211, 211); $text_color = ImageColorAllocate ($img, 0, 0, 0); $title_color = ImageColorAllocate ($img, 0, 0, 205); ImageString($img, 3, 3, 1, "Last Reboot of My Linux Box: ", $title_color); ImageString($img, 3, 3, 15, "$days days, $hours hours, $min minutes ago", $text_color); ImageString($img, 3, 3, 29, "Record Uptime:", $title_color); ImageString($img, 3, 3, 43, "$record[0] days, $record[1] hours, $record[2] minutes", $text_color); ImagePNG($img); ImageDestroy($img); ?> TIA Edit: Never mind. I didn't have all the php stuff installed. Carry on. ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.