From da772fca8ccb79a69a4b8596e0a0c621002174e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Hu=CC=88bner?= Date: Sat, 17 Feb 2018 01:51:25 +0100 Subject: [PATCH] Add type hint to canvas interface. --- src/Canvas/CanvasInterface.php | 4 +++- src/MapCache/MapCache.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Canvas/CanvasInterface.php b/src/Canvas/CanvasInterface.php index 9af8db9..57c86f3 100644 --- a/src/Canvas/CanvasInterface.php +++ b/src/Canvas/CanvasInterface.php @@ -2,9 +2,11 @@ namespace StaticMapLite\Canvas; +use Imagine\Image\ImageInterface; + interface CanvasInterface { - public function getImage(); + public function getImage(): ImageInterface; public function getWidth(): int; public function getHeight(): int; public function getCenterX(): float; diff --git a/src/MapCache/MapCache.php b/src/MapCache/MapCache.php index 87702b0..aa8cfd8 100644 --- a/src/MapCache/MapCache.php +++ b/src/MapCache/MapCache.php @@ -78,7 +78,8 @@ class MapCache public function cache(CanvasInterface $canvas): void { $this->mkdir_recursive(dirname($this->mapCacheIDToFilename()), 0777); - imagepng($canvas->getImage(), $this->mapCacheIDToFilename(), 9); + + $canvas->getImage()->save($this->mapCacheIDToFilename()); $output = new CacheOutput(); $output->setFilename($this->mapCacheIDToFilename())