Einzelnen Beitrag anzeigen
Alt 12.02.2003, 22:42   #7
käptn
Inventar
 
Registriert seit: 04.11.2001
Alter: 45
Beiträge: 2.150


Standard

Schweinelangsam, und GD muss mit GIF-Support kompiliert sein...

PHP-Code:
<?php
// Dein Status-GIF
$status_gif 'http://status.com/status.gif'
// PHP braucht Schreibrechte (777) im Verzeichnis
$temp_file  realpath('temp.gif'); 

$img_buffer null;

$red    180;
$green  24;

$green_file realpath('green.txt');
$red_file   realpath('red.txt');

$green_count  0;
$redf_count   0;
if (
is_file($green_file)) {
  list(
$green_count) = file($green_file);
}
if (
is_file($red_count)) {
  list(
$red_count) = file($red_file);
}

$fh fopen($status_gif'rb');
if (
is_resource($fh)) {
  while(
$buff fread($fh256)){
    
$img_buffer .= $buff;
  }
  
fclose($fh);
  
$fh fopen($temp_file'wb');
  if (
is_resource($fh)) {
    
fwrite($fh$img_buffer);
    
fclose($fh);
    
$img imagecreatefromgif($temp_file);
    if (
is_resource($img)) {
      
$col imagecolorat($img00);
      
imagedestroy($img);
      if (
$col == $green) {
        
f_write($green_file, ++$green_count);
      } elseif (
$col == $red) {
        
f_write($red_file, ++$red_count);
      } else {
        
// Punkt hat andere Farbe
      
}
    }
  }
}

function 
f_write($file$val){
  
$fh fopen($file'w');
  if (
is_resource($fh)) {
    
fwrite($fh$val);
    
fclose($fh);
  }
}
?>
~
____________________________________
LOL - Mein erstes Post im Programmier Forum

MACINTOSH - Most Applications Crash, If Not The Operating System Hangs
käptn ist offline   Mit Zitat antworten