Created
September 29, 2022 22:34
-
-
Save jules0x/45b698d0269d37f6f069d6fcd7df2350 to your computer and use it in GitHub Desktop.
Image from Map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'https://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&key=' . Config::inst()->get(GeocodeService::class, 'google_api_key'); | |
$folder = Folder::find_or_make('maps'); | |
$map = new Image(); | |
$map->setFromString(file_get_contents($url), 'map.png'); | |
$map->ParentID = $folder->ID; | |
$map->write(); | |
echo $map->forTemplate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment