mirror of
https://github.com/klokantech/tileserver-php.git
synced 2025-08-03 21:27:52 +02:00
Correct detection of format closes #67
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
$config['serverTitle'] = 'TileServer-php v1';
|
$config['serverTitle'] = 'TileServer-php v1';
|
||||||
|
$config['availableFormats'] = array('png', 'jpg', 'jpeg', 'gif', 'webp', 'hybrid');
|
||||||
//$config['baseUrls'] = array('t0.server.com', 't1.server.com');
|
//$config['baseUrls'] = array('t0.server.com', 't1.server.com');
|
||||||
|
|
||||||
Router::serve(array(
|
Router::serve(array(
|
||||||
@@ -241,6 +242,13 @@ class Server {
|
|||||||
$metadata['maxzoom'] = 18;
|
$metadata['maxzoom'] = 18;
|
||||||
}
|
}
|
||||||
if (!array_key_exists('format', $metadata)) {
|
if (!array_key_exists('format', $metadata)) {
|
||||||
|
if(array_key_exists('tiles', $metadata)){
|
||||||
|
$pos = strrpos($metadata['tiles'][0], '.');
|
||||||
|
$metadata['format'] = trim(substr($metadata['tiles'][0], $pos + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$formats = $this->config['availableFormats'];
|
||||||
|
if(!in_array(strtolower($metadata['format']), $formats)){
|
||||||
$metadata['format'] = 'png';
|
$metadata['format'] = 'png';
|
||||||
}
|
}
|
||||||
if (!array_key_exists('scale', $metadata)) {
|
if (!array_key_exists('scale', $metadata)) {
|
||||||
@@ -264,6 +272,16 @@ class Server {
|
|||||||
return $metadata;
|
return $metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function parseFormat($url){
|
||||||
|
|
||||||
|
return $mime;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SQLite connection
|
* SQLite connection
|
||||||
* @param string $tileset
|
* @param string $tileset
|
||||||
|
Reference in New Issue
Block a user