public function showMap() { $this->parseParams(); if ($this->useMapCache) { // use map cache, so check cache for map if (!$this->checkMapCache()) { // map is not in cache, needs to be build $this->makeMap(); $this->mkdir_recursive(dirname($this->mapCacheIDToFilename()), 0777); imagepng($this->image, $this->mapCacheIDToFilename(), 9); $this->sendHeader(); if (file_exists($this->mapCacheIDToFilename())) { return file_get_contents($this->mapCacheIDToFilename()); } else { return imagepng($this->image); } } else { // map is in cache $this->sendHeader(); return file_get_contents($this->mapCacheIDToFilename()); } } else { // no cache, make map, send headers and deliver png $this->makeMap(); $this->sendHeader(); return imagepng($this->image); } } } $map = new staticMapLite(); print $map->showMap();
if (!$this->checkMapCache()) { // map is not in cache, needs to be build $this->makeMap(); $this->mkdir_recursive(dirname($this->mapCacheIDToFilename()), 0777); imagepng($this->image, $this->mapCacheIDToFilename(), 9); $this->sendHeader(); if (file_exists($this->mapCacheIDToFilename())) { return file_get_contents($this->mapCacheIDToFilename()); } else { return imagepng($this->image); } } else { // map is in cache $this->sendHeader(); return file_get_contents($this->mapCacheIDToFilename()); } } else { // no cache, make map, send headers and deliver png $this->makeMap(); $this->sendHeader(); return imagepng($this->image); } } public static function get() { $map = new self(); print $map->showMap(); } } staticMapLite::get();