\******************************************************************************/ header('Cache-control: public'); $image = $_SERVER['QUERY_STRING']; if (!file_exists($image)) { /* TODO: Output error image. */ die(); } if (file_exists('.thumbs/prog-' . md5($image))) { $mtime = filemtime('.thumbs/prog-' . md5($image)); if ($mtime >= filemtime($image)) { header('Content-type: image/jpeg'); readfile('.thumbs/prog-' . md5($image)); exit; } } /* TODO: Optimise. */ if (($imi = @imagecreatefromjpeg($image)) === FALSE) { if (($imi = @imagecreatefrompng($image)) === FALSE) { if (($imi = @imagecreatefromgif($image)) === FALSE) { /* TODO: Output error image. */ die(); } } } header('Content-type: image/jpeg'); imageinterlace($imi, true); imagejpeg($imi, '.thumbs/prog-' . md5($image), 100); imagejpeg($imi, false, 100); ?>