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(); }