Commit 3b9a8fefc5a03f321b83b1afa0676d3b5f7e6c3c
1 parent
b58e197a
Exists in
master
and in
7 other branches
Contorno de erro do Mapserver na versão 6.0.3 ao criar imagens via save()
Showing
2 changed files
with
51 additions
and
7 deletions
Show diff stats
classesphp/mapa_googlemaps.php
| ... | ... | @@ -76,6 +76,24 @@ if(@$_SESSION["fingerprint"]){ |
| 76 | 76 | $f = explode(",",$_SESSION["fingerprint"]); |
| 77 | 77 | if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"],$f) ){ |
| 78 | 78 | ilegal(); |
| 79 | + } else{ | |
| 80 | + if($img->imagepath == "") | |
| 81 | + {echo "Erro IMAGEPATH vazio";exit;} | |
| 82 | + if(ms_GetVersionInt() != 60003 ){ | |
| 83 | + header('Content-Type: image/png'); | |
| 84 | + $img->saveImage(); | |
| 85 | + } | |
| 86 | + else{ | |
| 87 | + $nomer = ($img->imagepath)."temp".nomeRand().".png"; | |
| 88 | + $img->saveImage($nomer); | |
| 89 | + $img = imagecreatefrompng($nomer); | |
| 90 | + imagealphablending($img, false); | |
| 91 | + imagesavealpha($img, true); | |
| 92 | + ob_clean(); | |
| 93 | + echo header("Content-type: image/png \n\n"); | |
| 94 | + imagepng($img); | |
| 95 | + imagedestroy($img); | |
| 96 | + } | |
| 79 | 97 | } |
| 80 | 98 | } |
| 81 | 99 | else{ |
| ... | ... | @@ -296,11 +314,24 @@ else{ |
| 296 | 314 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); |
| 297 | 315 | fpassthru(fopen($nomer, 'rb')); |
| 298 | 316 | } |
| 299 | - else{ | |
| 317 | + else{ | |
| 300 | 318 | if($img->imagepath == "") |
| 301 | 319 | {echo "Erro IMAGEPATH vazio";exit;} |
| 302 | - header('Content-Type: image/png'); | |
| 303 | - $img->saveImage(); | |
| 320 | + if(ms_GetVersionInt() != 60003 ){ | |
| 321 | + header('Content-Type: image/png'); | |
| 322 | + $img->saveImage(); | |
| 323 | + } | |
| 324 | + else{ | |
| 325 | + $nomer = ($img->imagepath)."temp".nomeRand().".png"; | |
| 326 | + $img->saveImage($nomer); | |
| 327 | + $img = imagecreatefrompng($nomer); | |
| 328 | + imagealphablending($img, false); | |
| 329 | + imagesavealpha($img, true); | |
| 330 | + ob_clean(); | |
| 331 | + echo header("Content-type: image/png \n\n"); | |
| 332 | + imagepng($img); | |
| 333 | + imagedestroy($img); | |
| 334 | + } | |
| 304 | 335 | } |
| 305 | 336 | exit; |
| 306 | 337 | } | ... | ... |
classesphp/mapa_openlayers.php
| ... | ... | @@ -288,10 +288,23 @@ else{ |
| 288 | 288 | fpassthru(fopen($nomer, 'rb')); |
| 289 | 289 | } |
| 290 | 290 | else{ |
| 291 | - if($img->imagepath == "") | |
| 292 | - {echo "Erro IMAGEPATH vazio";exit;} | |
| 293 | - header('Content-Type: image/png'); | |
| 294 | - $img->saveImage(); | |
| 291 | + if($img->imagepath == "") | |
| 292 | + {echo "Erro IMAGEPATH vazio";exit;} | |
| 293 | + if(ms_GetVersionInt() != 60003 ){ | |
| 294 | + header('Content-Type: image/png'); | |
| 295 | + $img->saveImage(); | |
| 296 | + } | |
| 297 | + else{ | |
| 298 | + $nomer = ($img->imagepath)."temp".nomeRand().".png"; | |
| 299 | + $img->saveImage($nomer); | |
| 300 | + $img = imagecreatefrompng($nomer); | |
| 301 | + imagealphablending($img, false); | |
| 302 | + imagesavealpha($img, true); | |
| 303 | + ob_clean(); | |
| 304 | + echo header("Content-type: image/png \n\n"); | |
| 305 | + imagepng($img); | |
| 306 | + imagedestroy($img); | |
| 307 | + } | |
| 295 | 308 | } |
| 296 | 309 | } |
| 297 | 310 | function salvaCacheImagem($cachedir,$map,$tms){ | ... | ... |