X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplimage.php;h=99519c23fc11d0661c815657f2b68d7f6011715e;hb=4f4f166c817d12c39fe65aa5ceafc43e580e9fcc;hp=c4b3e05056bd3d342d69d47d50cb1d08c3346864;hpb=2ab75571bf840471fa9559292b75852bfce004d3;p=platal.git diff --git a/classes/plimage.php b/classes/plimage.php index c4b3e05..99519c2 100644 --- a/classes/plimage.php +++ b/classes/plimage.php @@ -20,19 +20,23 @@ ***************************************************************************/ class PlImage { - private $mime = null; - private $x = null; - private $y = null; + protected $mime = null; + protected $x = null; + protected $y = null; + protected $ts = null; - private $data = null; - private $file = 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; } }