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