Tom: MySQL Timestamp-Format für header('Last-Modified') gesucht

Beitrag lesen

Hello,

ich habe da noch ein altes Script im Fundus:

function put_image($filename,$bildtyp)
{
  if (strlen($filename)<=0)
  {
    return false;
  }

// prüfen, ob das Bild im Server neuer ist als im Cache des Browsers

$last_modified = @gmdate('D, d M Y H:i:s',@filemtime(PICPATH.$filename)).' GMT';

if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
  {
    // parse header
    $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);

if ($if_modified_since == $last_modified)
    {
      // the browser's cache is still up to date
      header("HTTP/1.0 304 Not Modified");
      header("Cache-Control: max-age=86400, must-revalidate");
      return true;
    }
  }

$fh=fopen(PICPATH.$filename,"r");
  if (!$fh)
  {
    return false;
  }

$picdata = fread($fh,filesize(PICPATH.$filename));

//$picdata = file_get_contents(PICPATH.$filename);  // ist auf Hoster-Server nicht
                                                      // verfügbar.

fclose($fh);

// ist ein Bild ist da?
  // sind die header schon gesendet?
  if ((strlen($picdata) <= 0) or headers_sent())
  {
    return false;
  }

header (make_content_type($bildtyp));
  header ("Last-Modified: $last_modified");
  echo $picdata;

return true;
}

Vielleicht kannst Du etwas damit anfangen

Liebe Grüße aus Syburg bei Dortmund

Tom vom Berg

--
Nur selber lernen macht schlau
http://bergpost.annerschbarrich.de