X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplimage.php;h=99519c23fc11d0661c815657f2b68d7f6011715e;hb=88541046480799a8d92eba186f22e22c0c64efb0;hp=232fb4765cc54ccdea30da77a358a9ca28ffd54c;hpb=d95208679c7ec4092e9e6156cd8eadd3fe15b9c0;p=platal.git diff --git a/classes/plimage.php b/classes/plimage.php index 232fb47..99519c2 100644 --- a/classes/plimage.php +++ b/classes/plimage.php @@ -23,16 +23,20 @@ class PlImage { protected $mime = null; protected $x = null; protected $y = null; + protected $ts = null; protected $data = null; protected $file = null; - private function __construct() + protected function __construct() { } public function send() { + if (!is_null($this->ts)) { + header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->ts) . ' GMT'); + } pl_cached_dynamic_content_headers($this->mime); if (empty($this->data)) { readfile($this->file); @@ -68,23 +72,25 @@ class PlImage { return $this->mime; } - public static function fromData($data, $mime, $x = null, $y = null) + public static function fromData($data, $mime, $x = null, $y = null, $ts = null) { $image = new PlImage(); $image->data = $data; $image->mime = $mime; $image->x = $x; $image->y = $y; + $image->ts = $ts; return $image; } - public static function fromFile($path, $mime, $x = null, $y = null) + public static function fromFile($path, $mime, $x = null, $y = null, $ts = null) { $image = new PlImage(); $image->file = $path; $image->mime = $mime; $image->x = $x; $image->y = $y; + $image->ts = $ts; return $image; } }