Commit f4a5d140084abe18afc601c42b5c07b352a107ee
1 parent
2b703b26
Exists in
master
and in
7 other branches
Ajustes de performance na geração do mapa
Showing
9 changed files
with
28 additions
and
325 deletions
Show diff stats
admin/admin.db
No preview for this file type
aplicmap/dados/mundo.prj
aplicmap/dados/mundo.qix
No preview for this file type
aplicmap/geral1debianv6.map
| ... | ... | @@ -167,14 +167,11 @@ MAP |
| 167 | 167 | "cache" "sim" |
| 168 | 168 | END |
| 169 | 169 | NAME "zee" |
| 170 | - SIZEUNITS PIXELS | |
| 171 | 170 | STATUS DEFAULT |
| 172 | - TOLERANCE 0 | |
| 173 | - TOLERANCEUNITS PIXELS | |
| 174 | 171 | TYPE POLYGON |
| 175 | 172 | CLASS |
| 176 | 173 | NAME " " |
| 177 | - COLOR 137 201 255 | |
| 174 | + OUTLINECOLOR 137 201 255 | |
| 178 | 175 | END |
| 179 | 176 | END |
| 180 | 177 | LAYER |
| ... | ... | @@ -192,45 +189,14 @@ MAP |
| 192 | 189 | "itembuscarapida" "LONG_NAME" |
| 193 | 190 | END |
| 194 | 191 | NAME "mundo" |
| 195 | - SIZEUNITS PIXELS | |
| 196 | 192 | STATUS DEFAULT |
| 197 | 193 | TEMPLATE "none.htm" |
| 198 | - TOLERANCE 0 | |
| 199 | - TOLERANCEUNITS PIXELS | |
| 200 | - TRANSPARENCY 100 | |
| 201 | 194 | TYPE POLYGON |
| 202 | - UNITS METERS | |
| 203 | 195 | CLASS |
| 204 | 196 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 205 | 197 | STYLE |
| 206 | 198 | COLOR 230 230 230 |
| 207 | - SIZE 1 | |
| 208 | - SYMBOL 0 | |
| 209 | - END | |
| 210 | - END | |
| 211 | - END | |
| 212 | - LAYER | |
| 213 | - DATA "/var/www/i3geo/aplicmap/dados/mundo" | |
| 214 | - GROUP "mundo" | |
| 215 | - METADATA | |
| 216 | - "CLASSE" "NAO" | |
| 217 | - "TEMA" "NAO" | |
| 218 | - "ESCONDIDO" "SIM" | |
| 219 | - "cache" "sim" | |
| 220 | - END | |
| 221 | - NAME "mundo2" | |
| 222 | - SIZEUNITS PIXELS | |
| 223 | - STATUS DEFAULT | |
| 224 | - TOLERANCE 0 | |
| 225 | - TOLERANCEUNITS PIXELS | |
| 226 | - TRANSPARENCY 100 | |
| 227 | - TYPE LINE | |
| 228 | - UNITS METERS | |
| 229 | - CLASS | |
| 230 | - STYLE | |
| 231 | - COLOR 255 255 255 | |
| 232 | - SIZE 3 | |
| 233 | - SYMBOL "linha" | |
| 199 | + OUTLINECOLOR 255 255 255 | |
| 234 | 200 | END |
| 235 | 201 | END |
| 236 | 202 | END |
| ... | ... | @@ -245,21 +211,13 @@ MAP |
| 245 | 211 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" |
| 246 | 212 | END |
| 247 | 213 | NAME "estados" |
| 248 | - SIZEUNITS PIXELS | |
| 249 | 214 | STATUS DEFAULT |
| 250 | - TOLERANCE 0 | |
| 251 | - TOLERANCEUNITS PIXELS | |
| 252 | - TRANSPARENCY 100 | |
| 253 | 215 | TYPE POLYGON |
| 254 | 216 | UNITS METERS |
| 255 | 217 | CLASS |
| 256 | 218 | NAME " " |
| 257 | 219 | STYLE |
| 258 | 220 | COLOR 232 220 201 |
| 259 | - MAXSIZE 100 | |
| 260 | - MINSIZE 1 | |
| 261 | - SIZE 1 | |
| 262 | - SYMBOL 0 | |
| 263 | 221 | END |
| 264 | 222 | END |
| 265 | 223 | END | ... | ... |
aplicmap/geral1fedorav6.map
| ... | ... | @@ -167,14 +167,11 @@ MAP |
| 167 | 167 | "cache" "sim" |
| 168 | 168 | END |
| 169 | 169 | NAME "zee" |
| 170 | - SIZEUNITS PIXELS | |
| 171 | 170 | STATUS DEFAULT |
| 172 | - TOLERANCE 0 | |
| 173 | - TOLERANCEUNITS PIXELS | |
| 174 | 171 | TYPE POLYGON |
| 175 | 172 | CLASS |
| 176 | 173 | NAME " " |
| 177 | - COLOR 137 201 255 | |
| 174 | + OUTLINECOLOR 137 201 255 | |
| 178 | 175 | END |
| 179 | 176 | END |
| 180 | 177 | LAYER |
| ... | ... | @@ -192,44 +189,15 @@ MAP |
| 192 | 189 | "itembuscarapida" "LONG_NAME" |
| 193 | 190 | END |
| 194 | 191 | NAME "mundo" |
| 195 | - SIZEUNITS PIXELS | |
| 196 | 192 | STATUS DEFAULT |
| 197 | 193 | TEMPLATE "none.htm" |
| 198 | - TOLERANCE 0 | |
| 199 | - TOLERANCEUNITS PIXELS | |
| 200 | - TRANSPARENCY 100 | |
| 201 | 194 | TYPE POLYGON |
| 202 | 195 | UNITS METERS |
| 203 | 196 | CLASS |
| 204 | 197 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 205 | 198 | STYLE |
| 206 | 199 | COLOR 230 230 230 |
| 207 | - SIZE 1 | |
| 208 | - SYMBOL 0 | |
| 209 | - END | |
| 210 | - END | |
| 211 | - END | |
| 212 | - LAYER | |
| 213 | - DATA "/var/www/html/i3geo/aplicmap/dados/mundo" | |
| 214 | - GROUP "mundo" | |
| 215 | - METADATA | |
| 216 | - "CLASSE" "NAO" | |
| 217 | - "TEMA" "NAO" | |
| 218 | - "ESCONDIDO" "SIM" | |
| 219 | - "cache" "sim" | |
| 220 | - END | |
| 221 | - NAME "mundo2" | |
| 222 | - SIZEUNITS PIXELS | |
| 223 | - STATUS DEFAULT | |
| 224 | - TOLERANCE 0 | |
| 225 | - TOLERANCEUNITS PIXELS | |
| 226 | - TRANSPARENCY 100 | |
| 227 | - TYPE LINE | |
| 228 | - UNITS METERS | |
| 229 | - CLASS | |
| 230 | - STYLE | |
| 231 | - COLOR 255 255 255 | |
| 232 | - WIDTH 3 | |
| 200 | + OUTLINECOLOR 255 255 255 | |
| 233 | 201 | END |
| 234 | 202 | END |
| 235 | 203 | END |
| ... | ... | @@ -244,21 +212,12 @@ MAP |
| 244 | 212 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" |
| 245 | 213 | END |
| 246 | 214 | NAME "estados" |
| 247 | - SIZEUNITS PIXELS | |
| 248 | 215 | STATUS DEFAULT |
| 249 | - TOLERANCE 0 | |
| 250 | - TOLERANCEUNITS PIXELS | |
| 251 | - TRANSPARENCY 100 | |
| 252 | 216 | TYPE POLYGON |
| 253 | - UNITS METERS | |
| 254 | 217 | CLASS |
| 255 | 218 | NAME " " |
| 256 | 219 | STYLE |
| 257 | 220 | COLOR 232 220 201 |
| 258 | - MAXSIZE 100 | |
| 259 | - MINSIZE 1 | |
| 260 | - SIZE 1 | |
| 261 | - SYMBOL 0 | |
| 262 | 221 | END |
| 263 | 222 | END |
| 264 | 223 | END | ... | ... |
aplicmap/geral1v6.map
| ... | ... | @@ -162,14 +162,11 @@ MAP |
| 162 | 162 | "cache" "sim" |
| 163 | 163 | END |
| 164 | 164 | NAME "zee" |
| 165 | - SIZEUNITS PIXELS | |
| 166 | 165 | STATUS DEFAULT |
| 167 | - TOLERANCE 0 | |
| 168 | - TOLERANCEUNITS PIXELS | |
| 169 | 166 | TYPE POLYGON |
| 170 | 167 | CLASS |
| 171 | 168 | NAME " " |
| 172 | - COLOR 137 201 255 | |
| 169 | + OUTLINECOLOR 137 201 255 | |
| 173 | 170 | END |
| 174 | 171 | END |
| 175 | 172 | LAYER |
| ... | ... | @@ -187,44 +184,14 @@ MAP |
| 187 | 184 | "itembuscarapida" "LONG_NAME" |
| 188 | 185 | END |
| 189 | 186 | NAME "mundo" |
| 190 | - SIZEUNITS PIXELS | |
| 191 | 187 | STATUS DEFAULT |
| 192 | 188 | TEMPLATE "none.htm" |
| 193 | - TOLERANCE 0 | |
| 194 | - TOLERANCEUNITS PIXELS | |
| 195 | - TRANSPARENCY 100 | |
| 196 | 189 | TYPE POLYGON |
| 197 | - UNITS METERS | |
| 198 | 190 | CLASS |
| 199 | 191 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 200 | 192 | STYLE |
| 201 | 193 | COLOR 230 230 230 |
| 202 | - SIZE 1 | |
| 203 | - SYMBOL 0 | |
| 204 | - END | |
| 205 | - END | |
| 206 | - END | |
| 207 | - LAYER | |
| 208 | - DATA "/opt/www/html/i3geo/aplicmap/dados/mundo" | |
| 209 | - GROUP "mundo" | |
| 210 | - METADATA | |
| 211 | - "CLASSE" "NAO" | |
| 212 | - "TEMA" "NAO" | |
| 213 | - "ESCONDIDO" "SIM" | |
| 214 | - "cache" "sim" | |
| 215 | - END | |
| 216 | - NAME "mundo2" | |
| 217 | - SIZEUNITS PIXELS | |
| 218 | - STATUS DEFAULT | |
| 219 | - TOLERANCE 0 | |
| 220 | - TOLERANCEUNITS PIXELS | |
| 221 | - TRANSPARENCY 100 | |
| 222 | - TYPE LINE | |
| 223 | - UNITS METERS | |
| 224 | - CLASS | |
| 225 | - STYLE | |
| 226 | - COLOR 255 255 255 | |
| 227 | - WIDTH 3 | |
| 194 | + OUTLINECOLOR 255 255 255 | |
| 228 | 195 | END |
| 229 | 196 | END |
| 230 | 197 | END |
| ... | ... | @@ -239,21 +206,13 @@ MAP |
| 239 | 206 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" |
| 240 | 207 | END |
| 241 | 208 | NAME "estados" |
| 242 | - SIZEUNITS PIXELS | |
| 243 | 209 | STATUS DEFAULT |
| 244 | 210 | TOLERANCE 0 |
| 245 | - TOLERANCEUNITS PIXELS | |
| 246 | - TRANSPARENCY 100 | |
| 247 | 211 | TYPE POLYGON |
| 248 | - UNITS METERS | |
| 249 | 212 | CLASS |
| 250 | 213 | NAME " " |
| 251 | 214 | STYLE |
| 252 | 215 | COLOR 232 220 201 |
| 253 | - MAXSIZE 100 | |
| 254 | - MINSIZE 1 | |
| 255 | - SIZE 1 | |
| 256 | - SYMBOL 0 | |
| 257 | 216 | END |
| 258 | 217 | END |
| 259 | 218 | END |
| ... | ... | @@ -336,7 +295,6 @@ MAP |
| 336 | 295 | "TEMA" "Rosa dos ventos" |
| 337 | 296 | "IDENTIFICA" "nao" |
| 338 | 297 | "TABELA" "nao" |
| 339 | - | |
| 340 | 298 | END |
| 341 | 299 | NAME "rosadosventos" |
| 342 | 300 | SIZEUNITS PIXELS | ... | ... |
aplicmap/geral1windowsv6.map
| ... | ... | @@ -163,20 +163,15 @@ MAP |
| 163 | 163 | #"MENSAGEM" "Isto é um teste de mensagem" |
| 164 | 164 | END |
| 165 | 165 | NAME "zee" |
| 166 | - SIZEUNITS PIXELS | |
| 167 | 166 | STATUS DEFAULT |
| 168 | - TOLERANCE 0 | |
| 169 | - TOLERANCEUNITS PIXELS | |
| 170 | 167 | TYPE POLYGON |
| 171 | 168 | CLASS |
| 172 | 169 | NAME " " |
| 173 | - COLOR 137 201 255 | |
| 170 | + OUTLINECOLOR 137 201 255 | |
| 174 | 171 | END |
| 175 | 172 | END |
| 176 | - | |
| 177 | 173 | LAYER |
| 178 | 174 | DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/mundo" |
| 179 | - GROUP "mundo" | |
| 180 | 175 | METADATA |
| 181 | 176 | "CLASSE" "SIM" #o simbolo sera mostrado na legenda |
| 182 | 177 | "ITENS" "FIPS_CNTRY,GMI_CNTRY,LONG_NAME,CNTRY_NAME" #itens que serao mostrados na opcao de identificacao |
| ... | ... | @@ -190,50 +185,18 @@ MAP |
| 190 | 185 | "itembuscarapida" "LONG_NAME" |
| 191 | 186 | END |
| 192 | 187 | NAME "mundo" |
| 193 | - SIZEUNITS PIXELS | |
| 194 | 188 | STATUS DEFAULT |
| 195 | 189 | TEMPLATE "none.htm" |
| 196 | - TOLERANCE 0 | |
| 197 | - TOLERANCEUNITS PIXELS | |
| 198 | - TRANSPARENCY 100 | |
| 199 | 190 | TYPE POLYGON |
| 200 | - UNITS METERS | |
| 201 | 191 | CLASS |
| 202 | 192 | NAME " " #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 203 | 193 | STYLE |
| 204 | 194 | COLOR 230 230 230 |
| 205 | - SIZE 1 | |
| 206 | - SYMBOL 0 | |
| 195 | + OUTLINECOLOR 255 255 255 | |
| 207 | 196 | END |
| 208 | 197 | END |
| 209 | 198 | END |
| 210 | 199 | LAYER |
| 211 | - DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/mundo" | |
| 212 | - GROUP "mundo" | |
| 213 | - METADATA | |
| 214 | - "CLASSE" "NAO" | |
| 215 | - "TEMA" "linha" | |
| 216 | - "TEMA" "NAO" | |
| 217 | - "ESCONDIDO" "SIM" | |
| 218 | - "cache" "sim" | |
| 219 | - END | |
| 220 | - NAME "mundo2" | |
| 221 | - SIZEUNITS PIXELS | |
| 222 | - STATUS DEFAULT | |
| 223 | - TOLERANCE 0 | |
| 224 | - TOLERANCEUNITS PIXELS | |
| 225 | - TRANSPARENCY 100 | |
| 226 | - TYPE LINE | |
| 227 | - UNITS METERS | |
| 228 | - CLASS | |
| 229 | - STYLE | |
| 230 | - COLOR 255 255 255 | |
| 231 | - WIDTH 3 | |
| 232 | - END | |
| 233 | - END | |
| 234 | - END | |
| 235 | - | |
| 236 | - LAYER | |
| 237 | 200 | DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/estados" |
| 238 | 201 | METADATA |
| 239 | 202 | "CLASSE" "SIM" |
| ... | ... | @@ -245,21 +208,12 @@ MAP |
| 245 | 208 | "cache" "sim" |
| 246 | 209 | END |
| 247 | 210 | NAME "estados" |
| 248 | - SIZEUNITS PIXELS | |
| 249 | 211 | STATUS DEFAULT |
| 250 | - TOLERANCE 0 | |
| 251 | - TOLERANCEUNITS PIXELS | |
| 252 | - TRANSPARENCY 100 | |
| 253 | 212 | TYPE POLYGON |
| 254 | - UNITS METERS | |
| 255 | 213 | CLASS |
| 256 | 214 | NAME " " |
| 257 | 215 | STYLE |
| 258 | 216 | COLOR 232 220 201 |
| 259 | - MAXSIZE 100 | |
| 260 | - MINSIZE 1 | |
| 261 | - SIZE 1 | |
| 262 | - SYMBOL 0 | |
| 263 | 217 | END |
| 264 | 218 | END |
| 265 | 219 | END | ... | ... |
classesphp/mapa_googlemaps.php
| ... | ... | @@ -294,33 +294,10 @@ else{ |
| 294 | 294 | $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; |
| 295 | 295 | $img->saveImage($nomer); |
| 296 | 296 | } |
| 297 | - ob_start(); | |
| 298 | - // assuming you have image data in $imagedata | |
| 299 | - $img = file_get_contents($nomer); | |
| 300 | - $length = strlen($img); | |
| 301 | - $ft = filemtime($nomer); | |
| 302 | - if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && (strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]) == $ft)) { | |
| 303 | - // Client's cache IS current, so we just respond '304 Not Modified'. | |
| 304 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 304); | |
| 305 | - } else { | |
| 306 | - // Image not cached or cache outdated, we respond '200 OK' and output the image. | |
| 307 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 200); | |
| 308 | - } | |
| 309 | - header('Accept-Ranges: bytes'); | |
| 310 | - header('Content-Length: '.$length); | |
| 297 | + header('Content-Length: '.filesize($nomer)); | |
| 311 | 298 | header('Content-Type: image/png'); |
| 312 | - print($img); | |
| 313 | - ob_end_flush(); | |
| 299 | + fpassthru(fopen($nomer, 'rb')); | |
| 314 | 300 | exit; |
| 315 | - /* | |
| 316 | - ob_clean(); | |
| 317 | - $img = imagecreatefrompng($nomer); | |
| 318 | - imagealphablending($img, false); | |
| 319 | - imagesavealpha($img, true); | |
| 320 | - ob_clean(); | |
| 321 | - echo header("Content-type: image/png \n\n"); | |
| 322 | - imagepng($img); | |
| 323 | - */ | |
| 324 | 301 | } |
| 325 | 302 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 326 | 303 | global $img,$map_size; |
| ... | ... | @@ -352,59 +329,11 @@ function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 352 | 329 | {$nome = $cachedir."/googlemaps/".$layer."/".$nome;} |
| 353 | 330 | if(file_exists($nome)) |
| 354 | 331 | { |
| 355 | - ob_start(); | |
| 356 | - // assuming you have image data in $imagedata | |
| 357 | - $img = file_get_contents($nome); | |
| 358 | - $length = strlen($img); | |
| 359 | - $ft = filemtime($nome); | |
| 360 | - if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && (strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]) == $ft)) { | |
| 361 | - // Client's cache IS current, so we just respond '304 Not Modified'. | |
| 362 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 304); | |
| 363 | - } else { | |
| 364 | - // Image not cached or cache outdated, we respond '200 OK' and output the image. | |
| 365 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 200); | |
| 366 | - } | |
| 367 | - header('Accept-Ranges: bytes'); | |
| 368 | - header('Content-Length: '.$length); | |
| 332 | + header('Content-Length: '.filesize($nome)); | |
| 369 | 333 | header('Content-Type: image/png'); |
| 370 | - print($img); | |
| 371 | - ob_end_flush(); | |
| 334 | + fpassthru(fopen($nome, 'rb')); | |
| 372 | 335 | exit; |
| 373 | 336 | } |
| 374 | - /* | |
| 375 | - if(file_exists($nome)) | |
| 376 | - { | |
| 377 | - if (!function_exists('imagepng')) | |
| 378 | - { | |
| 379 | - $s = PHP_SHLIB_SUFFIX; | |
| 380 | - @dl( 'php_gd.'.$s ); | |
| 381 | - if (!function_exists('imagepng')) | |
| 382 | - {@dl( 'php_gd2.'.$s );} | |
| 383 | - } | |
| 384 | - @$img = imagecreatefrompng($nome); | |
| 385 | - if(!$img) | |
| 386 | - { | |
| 387 | - $img = imagecreatetruecolor($w, $h); | |
| 388 | - imagealphablending($img, false); | |
| 389 | - imagesavealpha($img, true); | |
| 390 | - $bgc = imagecolorallocatealpha($img, 255, 255, 255,127); | |
| 391 | - $tc = imagecolorallocate($img, 255, 0, 0); | |
| 392 | - imagefilledrectangle($img, 0, 0, $w, $h, $bgc); | |
| 393 | - imagestring($img, 3, 5, 5, 'Erro ao ler ' . $nome, $tc); | |
| 394 | - } | |
| 395 | - else | |
| 396 | - { | |
| 397 | - imagealphablending($img, false); | |
| 398 | - imagesavealpha($img, true); | |
| 399 | - } | |
| 400 | - ob_clean(); | |
| 401 | - error_reporting(0); | |
| 402 | - echo header("Content-type: image/png \n\n"); | |
| 403 | - imagepng($img); | |
| 404 | - imagedestroy($img); | |
| 405 | - exit; | |
| 406 | - } | |
| 407 | - */ | |
| 408 | 337 | } |
| 409 | 338 | function nomeRand($n=10) |
| 410 | 339 | { | ... | ... |
classesphp/mapa_openlayers.php
| ... | ... | @@ -268,34 +268,10 @@ else{ |
| 268 | 268 | $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; |
| 269 | 269 | $img->saveImage($nomer); |
| 270 | 270 | } |
| 271 | - ob_start(); | |
| 272 | - // assuming you have image data in $imagedata | |
| 273 | - $img = file_get_contents($nomer); | |
| 274 | - $length = strlen($img); | |
| 275 | - $ft = filemtime($nomer); | |
| 276 | - if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && (strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]) == $ft)) { | |
| 277 | - // Client's cache IS current, so we just respond '304 Not Modified'. | |
| 278 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 304); | |
| 279 | - } else { | |
| 280 | - // Image not cached or cache outdated, we respond '200 OK' and output the image. | |
| 281 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 200); | |
| 282 | - } | |
| 283 | - header('Accept-Ranges: bytes'); | |
| 284 | - header('Content-Length: '.$length); | |
| 271 | + header('Content-Length: '.filesize($nomer)); | |
| 285 | 272 | header('Content-Type: image/png'); |
| 286 | - print($img); | |
| 287 | - ob_end_flush(); | |
| 273 | + fpassthru(fopen($nomer, 'rb')); | |
| 288 | 274 | exit; |
| 289 | -/* | |
| 290 | - ob_clean(); | |
| 291 | - $img = imagecreatefrompng($nomer); | |
| 292 | - imagealphablending($img, false); | |
| 293 | - imagesavealpha($img, true); | |
| 294 | - ob_clean(); | |
| 295 | - echo header("Content-type: image/png \n\n"); | |
| 296 | - imagepng($img); | |
| 297 | - imagedestroy($img); | |
| 298 | -*/ | |
| 299 | 275 | } |
| 300 | 276 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 301 | 277 | global $img,$map_size; |
| ... | ... | @@ -309,10 +285,10 @@ function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 309 | 285 | {$cachedir = dirname(dirname($map))."/cache/".$layer;} |
| 310 | 286 | else |
| 311 | 287 | {$cachedir = $cachedir."/".$layer;} |
| 312 | - @mkdir($cachedir,0777); | |
| 313 | 288 | $nome = $cachedir."/".$w.$h.$bbox.".png"; |
| 314 | 289 | if(!file_exists($nome)) |
| 315 | 290 | { |
| 291 | + @mkdir($cachedir,0777); | |
| 316 | 292 | $img->saveImage($nome); |
| 317 | 293 | chmod($nome,0777); |
| 318 | 294 | } |
| ... | ... | @@ -330,61 +306,31 @@ function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 330 | 306 | {$nome = $cachedir."/".$layer."/".$nome;} |
| 331 | 307 | if(file_exists($nome)) |
| 332 | 308 | { |
| 309 | +/* | |
| 310 | + header('Accept-Ranges: bytes'); | |
| 311 | + header('Content-Length: '.filesize($nome)); | |
| 312 | + header('Content-Type: image/png'); | |
| 313 | + ob_start; | |
| 314 | + ob_flush(); | |
| 315 | + readfile($nome); | |
| 316 | + exit; | |
| 317 | + | |
| 333 | 318 | ob_start(); |
| 334 | 319 | // assuming you have image data in $imagedata |
| 335 | 320 | $img = file_get_contents($nome); |
| 336 | 321 | $length = strlen($img); |
| 337 | - $ft = filemtime($nome); | |
| 338 | - if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && (strtotime($_SERVER["HTTP_IF_MODIFIED_SINCE"]) == $ft)) { | |
| 339 | - // Client's cache IS current, so we just respond '304 Not Modified'. | |
| 340 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 304); | |
| 341 | - } else { | |
| 342 | - // Image not cached or cache outdated, we respond '200 OK' and output the image. | |
| 343 | - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ft).' GMT', true, 200); | |
| 344 | - } | |
| 345 | 322 | header('Accept-Ranges: bytes'); |
| 346 | 323 | header('Content-Length: '.$length); |
| 347 | 324 | header('Content-Type: image/png'); |
| 348 | 325 | print($img); |
| 349 | 326 | ob_end_flush(); |
| 350 | 327 | exit; |
| 351 | - } | |
| 352 | - /* | |
| 353 | - if (!function_exists('imagepng')) | |
| 354 | - { | |
| 355 | - $s = PHP_SHLIB_SUFFIX; | |
| 356 | - @dl( 'php_gd2.'.$s ); | |
| 357 | - if (!function_exists('imagepng')) | |
| 358 | - @dl( 'php_gd.'.$s ); | |
| 359 | - } | |
| 360 | - @$img = imagecreatefrompng($nome); | |
| 361 | - if(!$img) | |
| 362 | - { | |
| 363 | - // Create a blank image | |
| 364 | - $img = imagecreatetruecolor($w, $h); | |
| 365 | - imagealphablending($img, false); | |
| 366 | - imagesavealpha($img, true); | |
| 367 | - | |
| 368 | - $bgc = imagecolorallocatealpha($img, 255, 255, 255,127); | |
| 369 | - $tc = imagecolorallocate($img, 255, 0, 0); | |
| 370 | - | |
| 371 | - imagefilledrectangle($img, 0, 0, $w, $h, $bgc); | |
| 372 | - // Output an error message | |
| 373 | - imagestring($img, 3, 5, 5, 'Erro ao ler ' . $nome, $tc); | |
| 374 | - } | |
| 375 | - else | |
| 376 | - { | |
| 377 | - imagealphablending($img, false); | |
| 378 | - imagesavealpha($img, true); | |
| 379 | - } | |
| 380 | - ob_clean(); | |
| 381 | - error_reporting(0); | |
| 382 | - echo header("Content-type: image/png \n\n"); | |
| 383 | - imagepng($img); | |
| 384 | - imagedestroy($img); | |
| 328 | +*/ | |
| 329 | + header('Content-Length: '.filesize($nome)); | |
| 330 | + header('Content-Type: image/png'); | |
| 331 | + fpassthru(fopen($nome, 'rb')); | |
| 385 | 332 | exit; |
| 386 | 333 | } |
| 387 | - */ | |
| 388 | 334 | } |
| 389 | 335 | function nomeRand($n=10) |
| 390 | 336 | { | ... | ... |