From 864f2be68f1de686f0bfbc2252bec8702461cdef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Hu=CC=88bner?= Date: Wed, 14 Feb 2018 18:26:22 +0100 Subject: [PATCH] WIP. --- src/Output/AbstractOutput.php | 17 +++++++++++++++++ src/Output/CacheOutput.php | 13 +------------ src/Output/ImageOutput.php | 13 +------------ src/Output/OutputInterface.php | 3 ++- 4 files changed, 21 insertions(+), 25 deletions(-) create mode 100644 src/Output/AbstractOutput.php diff --git a/src/Output/AbstractOutput.php b/src/Output/AbstractOutput.php new file mode 100644 index 0000000..ce67652 --- /dev/null +++ b/src/Output/AbstractOutput.php @@ -0,0 +1,17 @@ +filename); diff --git a/src/Output/ImageOutput.php b/src/Output/ImageOutput.php index 3a86cbb..38243bd 100644 --- a/src/Output/ImageOutput.php +++ b/src/Output/ImageOutput.php @@ -2,7 +2,7 @@ namespace StaticMapLite\Output; -class ImageOutput implements OutputInterface +class ImageOutput extends AbstractOutput { protected $image; @@ -13,17 +13,6 @@ class ImageOutput implements OutputInterface return $this; } - public function sendHeader(): OutputInterface - { - header('Content-Type: image/png'); - $expires = 60 * 60 * 24 * 14; - header('Pragma: public'); - header('Cache-Control: maxage=' . $expires); - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); - - return $this; - } - public function sendImage(): bool { return imagepng($this->image); diff --git a/src/Output/OutputInterface.php b/src/Output/OutputInterface.php index 1bbbca6..4b3e16e 100644 --- a/src/Output/OutputInterface.php +++ b/src/Output/OutputInterface.php @@ -4,5 +4,6 @@ namespace StaticMapLite\Output; interface OutputInterface { - + public function sendHeader(); + public function sendImage(); }