php-osm-static-api icon indicating copy to clipboard operation
php-osm-static-api copied to clipboard

Allow usage of Image instance directly

Open mwargan opened this issue 2 years ago • 0 comments

Sometimes we need to use an actual image passed to Markers, for example when we need to downscale the image first. This PR allows users to do so, and supports backwards compatibility and fallback to building an image fromPath if the provided parameter is not an Image already.

This PR basically makes this possible:

        $markerImage = Image::fromPath($icon);

        // Resize the image to the icon dimensions
        $markerImage->downscaleProportion($this->iconWidth, $this->iconHeight);

        $generatedMarkers = new Markers($markerImage);

mwargan avatar Dec 03 '23 14:12 mwargan