Commit 98bdcb429b62451a8f87fe1d1cb417845747a393

Authored by Edmar Moretti
1 parent 45496973

--no commit message

Showing 2 changed files with 31 additions and 11 deletions   Show diff stats
geraminiatura.php
... ... @@ -41,9 +41,10 @@ Parametro:
41 41  
42 42 tipo - tipo de retorno mini|grande|todos
43 43 */
  44 +//clearstatcache();
44 45 error_reporting(E_ALL);
45   -set_time_limit(300);
46   -ini_set('max_execution_time', 300);
  46 +//set_time_limit(300);
  47 +//ini_set('max_execution_time', 300);
47 48 //
48 49 //carrega o phpmapscript
49 50 //
... ... @@ -85,16 +86,23 @@ if($tipo == "mini" || $tipo == "todos" || $tipo == "grande" || $tipo == "")
85 86  
86 87 error_reporting(E_ALL);
87 88 $arqs = listaArquivos("temas");
  89 + ob_start();
88 90 foreach ($arqs["arquivos"] as $arq)
89 91 {
90 92 $temp = explode(".",$arq);
91 93 if($temp[(count($temp) - 1)] == "map")
92 94 {
  95 + //if(file_exists($locaplic.'/temas/miniaturas/'.$arq.'.mini.png') == false)
  96 + //echo $locaplic.'/temas/miniaturas/'.$arq.'.mini.png<br>';
93 97 if($tipo == "mini" || $tipo == "todos")
94   - {if(!file_exists('temas/miniaturas/'.$arq.'.mini.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"mini");}}
  98 + {if(!file_exists($locaplic.'/temas/miniaturas/'.$arq.'.mini.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"mini");}}
95 99 if($tipo == "grande" || $tipo == "todos")
96   - {if(!file_exists('temas/miniaturas/'.$arq.'.grande.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"grande");}}
  100 + {if(!file_exists($locaplic.'/temas/miniaturas/'.$arq.'.grande.png')){echo "<br>".$arq."<br>";verificaMiniatura($arq,"grande");}}
97 101 }
  102 + ob_end_flush();
  103 + ob_flush();
  104 + flush();
  105 + ob_start();
98 106 }
99 107 }
100 108 //
... ... @@ -103,8 +111,8 @@ if($tipo == &quot;mini&quot; || $tipo == &quot;todos&quot; || $tipo == &quot;grande&quot; || $tipo == &quot;&quot;)
103 111 function verificaMiniatura($map,$tipo,$admin=false)
104 112 {
105 113 global $locaplic,$versao;
  114 + //echo $map."<br>";return;
106 115 ms_ResetErrorList();
107   - error_reporting(E_ALL);
108 116 $tema = "";
109 117 $map = str_replace("\\","/",$map);
110 118 $map = basename($map);
... ... @@ -157,15 +165,19 @@ function verificaMiniatura($map,$tipo,$admin=false)
157 165 }
158 166 }
159 167 }
  168 +
160 169 zoomTemaMiniatura($pegarext,$mapa);
161 170 if ($tipo == "mini" || $tipo == "todos")
162 171 {
163   - $mapa->setsize(50,50);
  172 +
  173 + $mapa->setsize(50,50);
164 174 $sca = $mapa->scalebar;
165 175 $sca->set("status",MS_OFF);
166 176 $objImagemM = @$mapa->draw();
167   - if (!$objImagemM)
  177 +
  178 + if ($objImagemM == "" || $objImagemM == MS_FAILURE)
168 179 {echo "Problemas ao gerar o mapa<br>";return;}
  180 +
169 181 $weboM = $mapa->web;
170 182 $urlM = $weboM->imageurl."/".$map;
171 183 }
... ... @@ -175,7 +187,7 @@ function verificaMiniatura($map,$tipo,$admin=false)
175 187 $sca = $mapa->scalebar;
176 188 $sca->set("status",MS_OFF);
177 189 $objImagemG = @$mapa->draw();
178   - if (!$objImagemG)
  190 + if ($objImagemG == "" || $objImagemG == MS_FAILURE)
179 191 {echo "Problemas ao gerar o mapa<br>";return;}
180 192 $weboG = $mapa->web;
181 193 $urlG = $weboG->imageurl."/".$map;
... ... @@ -183,12 +195,14 @@ function verificaMiniatura($map,$tipo,$admin=false)
183 195 if($tipo=="mini" || $tipo == "todos")
184 196 {
185 197 if($objImagemM->imagepath == "")
186   - {echo "Erro IMAGEPATH vazio";exit;}
  198 + {echo "Erro IMAGEPATH vazio";return;}
187 199 $nomecM = ($objImagemM->imagepath).$map.".mini.png";
188 200 $objImagemM->saveImage($nomecM);
189 201 }
190 202 if($tipo=="grande" || $tipo == "todos")
191 203 {
  204 + if($objImagemG->imagepath == "")
  205 + {echo "Erro IMAGEPATH vazio";return;}
192 206 $nomecG = ($objImagemG->imagepath).$map.".grande.png";
193 207 $objImagemG->saveImage($nomecG);
194 208 }
... ... @@ -220,6 +234,8 @@ function verificaMiniatura($map,$tipo,$admin=false)
220 234 function zoomTemaMiniatura($nomelayer,&$mapa)
221 235 {
222 236 $layer = $mapa->getlayerbyname($nomelayer);
  237 + if($layer->data == "" && $layer->connection == "")
  238 + {return;}
223 239 if($layer->type > 2)
224 240 {return;}
225 241 $prjMapa = $mapa->getProjection();
... ... @@ -232,6 +248,7 @@ function zoomTemaMiniatura($nomelayer,&amp;$mapa)
232 248 if ($ret == "")
233 249 {
234 250 $ret = $layer->getextent();
  251 + if(!$ret){return;}
235 252 //reprojeta o retangulo
236 253 if (($prjTema != "") && ($prjMapa != $prjTema))
237 254 {
... ...
testamapfile.php
... ... @@ -54,7 +54,7 @@ include(&quot;ms_configura.php&quot;);
54 54 include("classesphp/funcoes_gerais.php");
55 55 require_once("classesphp/pega_variaveis.php");
56 56 include_once ("classesphp/carrega_ext.php");
57   -error_reporting(0);
  57 +
58 58 //
59 59 //carrega o phpmapscript
60 60 //
... ... @@ -195,6 +195,7 @@ function verifica($map,$solegenda)
195 195 if ($layern->connectiontype == MS_POSTGIS)
196 196 {
197 197 $lcon = $layern->connection;
  198 + error_reporting(0);
198 199 if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa))))
199 200 {
200 201 //
... ... @@ -212,7 +213,7 @@ function verifica($map,$solegenda)
212 213 }
213 214 }
214 215 }
215   -
  216 + error_reporting(E_ALL);
216 217 autoClasses($layern,$nmapa);
217 218 if($layern->classitem != "" && $layern->connectiontype == 7 && $layern->numclasses > 0 && $layern->getmetadata("wms_sld_body") == ""){
218 219 $tipotemp = $layern->type;
... ... @@ -310,6 +311,8 @@ function verifica($map,$solegenda)
310 311 function zoomTema($nomelayer,&$mapa)
311 312 {
312 313 $layer = $mapa->getlayerbyname($nomelayer);
  314 + if($layer->data == "" && $layer->connection == "")
  315 + {return;}
313 316 $prjMapa = $mapa->getProjection();
314 317 $prjTema = $layer->getProjection();
315 318 $extatual = $mapa->extent;
... ...