From 6008660afcb222ba52e6a861e1a7d365c7c369a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Hu=CC=88bner?= Date: Sat, 17 Feb 2018 01:47:31 +0100 Subject: [PATCH] WIP for copyright. --- src/CopyrightPrinter/CopyrightPrinter.php | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/CopyrightPrinter/CopyrightPrinter.php b/src/CopyrightPrinter/CopyrightPrinter.php index 086cf73..5d6b8dc 100644 --- a/src/CopyrightPrinter/CopyrightPrinter.php +++ b/src/CopyrightPrinter/CopyrightPrinter.php @@ -2,12 +2,14 @@ namespace StaticMapLite\CopyrightPrinter; +use Imagine\Gd\Imagine; +use Imagine\Image\Point; use StaticMapLite\Canvas\CanvasInterface; class CopyrightPrinter implements CopyrightPrinterInterface { - /** @var string $osmLogo */ - protected $osmLogo = '../images/osm_logo.png'; + /** @var string $copyrightPath */ + protected $copyrightPath = '../images/osm_logo.png'; /** @var CanvasInterface $canvas */ protected $canvas; @@ -21,21 +23,12 @@ class CopyrightPrinter implements CopyrightPrinterInterface public function printCopyright(): CopyrightPrinterInterface { - $logo = imagecreatefrompng($this->osmLogo); + $imagine = new Imagine(); + $copyrightImage = $imagine->open($this->copyrightPath); - $logoWidth = imagesx($logo); - $logoHeight = imagesy($logo); + $point = new Point(0,0); - imagecopy( - $this->canvas->getImage(), - $logo, - imagesx($this->canvas->getImage()) - $logoWidth, - imagesy($this->canvas->getImage()) - $logoHeight, - 0, - 0, - $logoWidth, - $logoHeight - ); + $this->canvas->getImage()->paste($copyrightImage, $point); return $this; }