[Mapbender-commits] r10082 - in trunk/mapbender: http_auth/http owsproxy/http
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Mar 20 07:46:04 PDT 2019
Author: armin11
Date: 2019-03-20 07:46:04 -0700 (Wed, 20 Mar 2019)
New Revision: 10082
Modified:
trunk/mapbender/http_auth/http/index.php
trunk/mapbender/owsproxy/http/index.php
Log:
Fix for mime/type / format
Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php 2019-03-20 10:57:25 UTC (rev 10081)
+++ trunk/mapbender/http_auth/http/index.php 2019-03-20 14:46:04 UTC (rev 10082)
@@ -644,26 +644,33 @@
function responseImage($im)
{
global $reqParams;
- $format = $reqParams['format'];
- $format = "image/gif";
- if ($format == 'image/png') {
+ global $imageformats;
+ if (!in_array($reqParams['format'], $imageformats)) {
header("Content-Type: image/png");
- }
- if ($format == 'image/jpeg' || $format == 'image/jpg') {
- header("Content-Type: image/jpeg");
- }
- if ($format == 'image/gif') {
- header("Content-Type: image/gif");
- }
- if ($format == 'image/png') {
imagepng($im);
+ } else {
+ $format = $reqParams['format'];
+ //$format = "image/gif";
+ if ($format == 'image/png') {
+ header("Content-Type: image/png");
+ }
+ if ($format == 'image/jpeg' || $format == 'image/jpg') {
+ header("Content-Type: image/jpeg");
+ }
+ if ($format == 'image/gif') {
+ header("Content-Type: image/gif");
+ }
+
+ if ($format == 'image/png') {
+ imagepng($im);
+ }
+ if ($format == 'image/jpeg' || $format == 'image/jpg') {
+ imagejpeg($im);
+ }
+ if ($format == 'image/gif') {
+ imagegif($im);
+ }
}
- if ($format == 'image/jpeg' || $format == 'image/jpg') {
- imagejpeg($im);
- }
- if ($format == 'image/gif') {
- imagegif($im);
- }
}
function completeURL($url)
@@ -686,8 +693,13 @@
*/
function getImage($log_id, $or)
{
- global $reqParams;
- header("Content-Type: " . $reqParams['format']);
+ global $reqParams;
+ global $imageformats;
+ if (!in_array($reqParams['format'], $imageformats)) {
+ $header = "Content-Type: image/png";
+ } else {
+ $header = "Content-Type: ".$reqParams['format'];
+ }
if (func_num_args() == 3) { //new for HTTP Authentication
$auth = func_get_arg(2);
//$e = new mb_exception("try to get: ". $or);
Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php 2019-03-20 10:57:25 UTC (rev 10081)
+++ trunk/mapbender/owsproxy/http/index.php 2019-03-20 14:46:04 UTC (rev 10082)
@@ -556,27 +556,33 @@
function responseImage($im)
{
global $reqParams;
- $format = $reqParams['format'];
- $format = "image/gif";
- if ($format == 'image/png') {
+ global $imageformats;
+ if (!in_array($reqParams['format'], $imageformats)) {
header("Content-Type: image/png");
- }
- if ($format == 'image/jpeg' || $format == 'image/jpg') {
- header("Content-Type: image/jpeg");
- }
- if ($format == 'image/gif') {
- header("Content-Type: image/gif");
- }
+ imagepng($im);
+ } else {
+ $format = $reqParams['format'];
+ //$format = "image/gif";
+ if ($format == 'image/png') {
+ header("Content-Type: image/png");
+ }
+ if ($format == 'image/jpeg' || $format == 'image/jpg') {
+ header("Content-Type: image/jpeg");
+ }
+ if ($format == 'image/gif') {
+ header("Content-Type: image/gif");
+ }
- if ($format == 'image/png') {
- imagepng($im);
+ if ($format == 'image/png') {
+ imagepng($im);
+ }
+ if ($format == 'image/jpeg' || $format == 'image/jpg') {
+ imagejpeg($im);
+ }
+ if ($format == 'image/gif') {
+ imagegif($im);
+ }
}
- if ($format == 'image/jpeg' || $format == 'image/jpg') {
- imagejpeg($im);
- }
- if ($format == 'image/gif') {
- imagegif($im);
- }
}
function completeURL($url)
@@ -600,13 +606,18 @@
function getImage($log_id, $or)
{
global $reqParams;
- $header = "Content-Type: ".$reqParams['format'];
+ global $imageformats;
+ if (!in_array($reqParams['format'], $imageformats)) {
+ $header = "Content-Type: image/png";
+ } else {
+ $header = "Content-Type: ".$reqParams['format'];
+ }
#log the image_requests to database
#log the following to table mb_proxy_log
#timestamp,user_id,getmaprequest,amount pixel,price - but do this only for wms to log - therefor first get log tag out of wms!
#
- #
- if (func_num_args() == 3) { //new for HTTP Authentication
+ #
+ if (func_num_args() == 3) { //new for HTTP Authentication
$auth = func_get_arg(2);
getDocumentContent($log_id, $or, $header, $auth);
} else {
More information about the Mapbender_commits
mailing list