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,14 +167,11 @@ MAP | ||
| 167 | "cache" "sim" | 167 | "cache" "sim" |
| 168 | END | 168 | END |
| 169 | NAME "zee" | 169 | NAME "zee" |
| 170 | - SIZEUNITS PIXELS | ||
| 171 | STATUS DEFAULT | 170 | STATUS DEFAULT |
| 172 | - TOLERANCE 0 | ||
| 173 | - TOLERANCEUNITS PIXELS | ||
| 174 | TYPE POLYGON | 171 | TYPE POLYGON |
| 175 | CLASS | 172 | CLASS |
| 176 | NAME " " | 173 | NAME " " |
| 177 | - COLOR 137 201 255 | 174 | + OUTLINECOLOR 137 201 255 |
| 178 | END | 175 | END |
| 179 | END | 176 | END |
| 180 | LAYER | 177 | LAYER |
| @@ -192,45 +189,14 @@ MAP | @@ -192,45 +189,14 @@ MAP | ||
| 192 | "itembuscarapida" "LONG_NAME" | 189 | "itembuscarapida" "LONG_NAME" |
| 193 | END | 190 | END |
| 194 | NAME "mundo" | 191 | NAME "mundo" |
| 195 | - SIZEUNITS PIXELS | ||
| 196 | STATUS DEFAULT | 192 | STATUS DEFAULT |
| 197 | TEMPLATE "none.htm" | 193 | TEMPLATE "none.htm" |
| 198 | - TOLERANCE 0 | ||
| 199 | - TOLERANCEUNITS PIXELS | ||
| 200 | - TRANSPARENCY 100 | ||
| 201 | TYPE POLYGON | 194 | TYPE POLYGON |
| 202 | - UNITS METERS | ||
| 203 | CLASS | 195 | CLASS |
| 204 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo | 196 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 205 | STYLE | 197 | STYLE |
| 206 | COLOR 230 230 230 | 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 | END | 200 | END |
| 235 | END | 201 | END |
| 236 | END | 202 | END |
| @@ -245,21 +211,13 @@ MAP | @@ -245,21 +211,13 @@ MAP | ||
| 245 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" | 211 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" |
| 246 | END | 212 | END |
| 247 | NAME "estados" | 213 | NAME "estados" |
| 248 | - SIZEUNITS PIXELS | ||
| 249 | STATUS DEFAULT | 214 | STATUS DEFAULT |
| 250 | - TOLERANCE 0 | ||
| 251 | - TOLERANCEUNITS PIXELS | ||
| 252 | - TRANSPARENCY 100 | ||
| 253 | TYPE POLYGON | 215 | TYPE POLYGON |
| 254 | UNITS METERS | 216 | UNITS METERS |
| 255 | CLASS | 217 | CLASS |
| 256 | NAME " " | 218 | NAME " " |
| 257 | STYLE | 219 | STYLE |
| 258 | COLOR 232 220 201 | 220 | COLOR 232 220 201 |
| 259 | - MAXSIZE 100 | ||
| 260 | - MINSIZE 1 | ||
| 261 | - SIZE 1 | ||
| 262 | - SYMBOL 0 | ||
| 263 | END | 221 | END |
| 264 | END | 222 | END |
| 265 | END | 223 | END |
aplicmap/geral1fedorav6.map
| @@ -167,14 +167,11 @@ MAP | @@ -167,14 +167,11 @@ MAP | ||
| 167 | "cache" "sim" | 167 | "cache" "sim" |
| 168 | END | 168 | END |
| 169 | NAME "zee" | 169 | NAME "zee" |
| 170 | - SIZEUNITS PIXELS | ||
| 171 | STATUS DEFAULT | 170 | STATUS DEFAULT |
| 172 | - TOLERANCE 0 | ||
| 173 | - TOLERANCEUNITS PIXELS | ||
| 174 | TYPE POLYGON | 171 | TYPE POLYGON |
| 175 | CLASS | 172 | CLASS |
| 176 | NAME " " | 173 | NAME " " |
| 177 | - COLOR 137 201 255 | 174 | + OUTLINECOLOR 137 201 255 |
| 178 | END | 175 | END |
| 179 | END | 176 | END |
| 180 | LAYER | 177 | LAYER |
| @@ -192,44 +189,15 @@ MAP | @@ -192,44 +189,15 @@ MAP | ||
| 192 | "itembuscarapida" "LONG_NAME" | 189 | "itembuscarapida" "LONG_NAME" |
| 193 | END | 190 | END |
| 194 | NAME "mundo" | 191 | NAME "mundo" |
| 195 | - SIZEUNITS PIXELS | ||
| 196 | STATUS DEFAULT | 192 | STATUS DEFAULT |
| 197 | TEMPLATE "none.htm" | 193 | TEMPLATE "none.htm" |
| 198 | - TOLERANCE 0 | ||
| 199 | - TOLERANCEUNITS PIXELS | ||
| 200 | - TRANSPARENCY 100 | ||
| 201 | TYPE POLYGON | 194 | TYPE POLYGON |
| 202 | UNITS METERS | 195 | UNITS METERS |
| 203 | CLASS | 196 | CLASS |
| 204 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo | 197 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 205 | STYLE | 198 | STYLE |
| 206 | COLOR 230 230 230 | 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 | END | 201 | END |
| 234 | END | 202 | END |
| 235 | END | 203 | END |
| @@ -244,21 +212,12 @@ MAP | @@ -244,21 +212,12 @@ MAP | ||
| 244 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" | 212 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" |
| 245 | END | 213 | END |
| 246 | NAME "estados" | 214 | NAME "estados" |
| 247 | - SIZEUNITS PIXELS | ||
| 248 | STATUS DEFAULT | 215 | STATUS DEFAULT |
| 249 | - TOLERANCE 0 | ||
| 250 | - TOLERANCEUNITS PIXELS | ||
| 251 | - TRANSPARENCY 100 | ||
| 252 | TYPE POLYGON | 216 | TYPE POLYGON |
| 253 | - UNITS METERS | ||
| 254 | CLASS | 217 | CLASS |
| 255 | NAME " " | 218 | NAME " " |
| 256 | STYLE | 219 | STYLE |
| 257 | COLOR 232 220 201 | 220 | COLOR 232 220 201 |
| 258 | - MAXSIZE 100 | ||
| 259 | - MINSIZE 1 | ||
| 260 | - SIZE 1 | ||
| 261 | - SYMBOL 0 | ||
| 262 | END | 221 | END |
| 263 | END | 222 | END |
| 264 | END | 223 | END |
aplicmap/geral1v6.map
| @@ -162,14 +162,11 @@ MAP | @@ -162,14 +162,11 @@ MAP | ||
| 162 | "cache" "sim" | 162 | "cache" "sim" |
| 163 | END | 163 | END |
| 164 | NAME "zee" | 164 | NAME "zee" |
| 165 | - SIZEUNITS PIXELS | ||
| 166 | STATUS DEFAULT | 165 | STATUS DEFAULT |
| 167 | - TOLERANCE 0 | ||
| 168 | - TOLERANCEUNITS PIXELS | ||
| 169 | TYPE POLYGON | 166 | TYPE POLYGON |
| 170 | CLASS | 167 | CLASS |
| 171 | NAME " " | 168 | NAME " " |
| 172 | - COLOR 137 201 255 | 169 | + OUTLINECOLOR 137 201 255 |
| 173 | END | 170 | END |
| 174 | END | 171 | END |
| 175 | LAYER | 172 | LAYER |
| @@ -187,44 +184,14 @@ MAP | @@ -187,44 +184,14 @@ MAP | ||
| 187 | "itembuscarapida" "LONG_NAME" | 184 | "itembuscarapida" "LONG_NAME" |
| 188 | END | 185 | END |
| 189 | NAME "mundo" | 186 | NAME "mundo" |
| 190 | - SIZEUNITS PIXELS | ||
| 191 | STATUS DEFAULT | 187 | STATUS DEFAULT |
| 192 | TEMPLATE "none.htm" | 188 | TEMPLATE "none.htm" |
| 193 | - TOLERANCE 0 | ||
| 194 | - TOLERANCEUNITS PIXELS | ||
| 195 | - TRANSPARENCY 100 | ||
| 196 | TYPE POLYGON | 189 | TYPE POLYGON |
| 197 | - UNITS METERS | ||
| 198 | CLASS | 190 | CLASS |
| 199 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo | 191 | NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 200 | STYLE | 192 | STYLE |
| 201 | COLOR 230 230 230 | 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 | END | 195 | END |
| 229 | END | 196 | END |
| 230 | END | 197 | END |
| @@ -239,21 +206,13 @@ MAP | @@ -239,21 +206,13 @@ MAP | ||
| 239 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" | 206 | "EXTENSAO" "-97.911949 -39.413578 -8.185829 9.511159" |
| 240 | END | 207 | END |
| 241 | NAME "estados" | 208 | NAME "estados" |
| 242 | - SIZEUNITS PIXELS | ||
| 243 | STATUS DEFAULT | 209 | STATUS DEFAULT |
| 244 | TOLERANCE 0 | 210 | TOLERANCE 0 |
| 245 | - TOLERANCEUNITS PIXELS | ||
| 246 | - TRANSPARENCY 100 | ||
| 247 | TYPE POLYGON | 211 | TYPE POLYGON |
| 248 | - UNITS METERS | ||
| 249 | CLASS | 212 | CLASS |
| 250 | NAME " " | 213 | NAME " " |
| 251 | STYLE | 214 | STYLE |
| 252 | COLOR 232 220 201 | 215 | COLOR 232 220 201 |
| 253 | - MAXSIZE 100 | ||
| 254 | - MINSIZE 1 | ||
| 255 | - SIZE 1 | ||
| 256 | - SYMBOL 0 | ||
| 257 | END | 216 | END |
| 258 | END | 217 | END |
| 259 | END | 218 | END |
| @@ -336,7 +295,6 @@ MAP | @@ -336,7 +295,6 @@ MAP | ||
| 336 | "TEMA" "Rosa dos ventos" | 295 | "TEMA" "Rosa dos ventos" |
| 337 | "IDENTIFICA" "nao" | 296 | "IDENTIFICA" "nao" |
| 338 | "TABELA" "nao" | 297 | "TABELA" "nao" |
| 339 | - | ||
| 340 | END | 298 | END |
| 341 | NAME "rosadosventos" | 299 | NAME "rosadosventos" |
| 342 | SIZEUNITS PIXELS | 300 | SIZEUNITS PIXELS |
aplicmap/geral1windowsv6.map
| @@ -163,20 +163,15 @@ MAP | @@ -163,20 +163,15 @@ MAP | ||
| 163 | #"MENSAGEM" "Isto é um teste de mensagem" | 163 | #"MENSAGEM" "Isto é um teste de mensagem" |
| 164 | END | 164 | END |
| 165 | NAME "zee" | 165 | NAME "zee" |
| 166 | - SIZEUNITS PIXELS | ||
| 167 | STATUS DEFAULT | 166 | STATUS DEFAULT |
| 168 | - TOLERANCE 0 | ||
| 169 | - TOLERANCEUNITS PIXELS | ||
| 170 | TYPE POLYGON | 167 | TYPE POLYGON |
| 171 | CLASS | 168 | CLASS |
| 172 | NAME " " | 169 | NAME " " |
| 173 | - COLOR 137 201 255 | 170 | + OUTLINECOLOR 137 201 255 |
| 174 | END | 171 | END |
| 175 | END | 172 | END |
| 176 | - | ||
| 177 | LAYER | 173 | LAYER |
| 178 | DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/mundo" | 174 | DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/mundo" |
| 179 | - GROUP "mundo" | ||
| 180 | METADATA | 175 | METADATA |
| 181 | "CLASSE" "SIM" #o simbolo sera mostrado na legenda | 176 | "CLASSE" "SIM" #o simbolo sera mostrado na legenda |
| 182 | "ITENS" "FIPS_CNTRY,GMI_CNTRY,LONG_NAME,CNTRY_NAME" #itens que serao mostrados na opcao de identificacao | 177 | "ITENS" "FIPS_CNTRY,GMI_CNTRY,LONG_NAME,CNTRY_NAME" #itens que serao mostrados na opcao de identificacao |
| @@ -190,50 +185,18 @@ MAP | @@ -190,50 +185,18 @@ MAP | ||
| 190 | "itembuscarapida" "LONG_NAME" | 185 | "itembuscarapida" "LONG_NAME" |
| 191 | END | 186 | END |
| 192 | NAME "mundo" | 187 | NAME "mundo" |
| 193 | - SIZEUNITS PIXELS | ||
| 194 | STATUS DEFAULT | 188 | STATUS DEFAULT |
| 195 | TEMPLATE "none.htm" | 189 | TEMPLATE "none.htm" |
| 196 | - TOLERANCE 0 | ||
| 197 | - TOLERANCEUNITS PIXELS | ||
| 198 | - TRANSPARENCY 100 | ||
| 199 | TYPE POLYGON | 190 | TYPE POLYGON |
| 200 | - UNITS METERS | ||
| 201 | CLASS | 191 | CLASS |
| 202 | NAME " " #vazio indica que nao sera incluido o nome ao lado do simbolo | 192 | NAME " " #vazio indica que nao sera incluido o nome ao lado do simbolo |
| 203 | STYLE | 193 | STYLE |
| 204 | COLOR 230 230 230 | 194 | COLOR 230 230 230 |
| 205 | - SIZE 1 | ||
| 206 | - SYMBOL 0 | 195 | + OUTLINECOLOR 255 255 255 |
| 207 | END | 196 | END |
| 208 | END | 197 | END |
| 209 | END | 198 | END |
| 210 | LAYER | 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 | DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/estados" | 200 | DATA "c:\ms4w\apache\htdocs\i3geo/aplicmap/dados/estados" |
| 238 | METADATA | 201 | METADATA |
| 239 | "CLASSE" "SIM" | 202 | "CLASSE" "SIM" |
| @@ -245,21 +208,12 @@ MAP | @@ -245,21 +208,12 @@ MAP | ||
| 245 | "cache" "sim" | 208 | "cache" "sim" |
| 246 | END | 209 | END |
| 247 | NAME "estados" | 210 | NAME "estados" |
| 248 | - SIZEUNITS PIXELS | ||
| 249 | STATUS DEFAULT | 211 | STATUS DEFAULT |
| 250 | - TOLERANCE 0 | ||
| 251 | - TOLERANCEUNITS PIXELS | ||
| 252 | - TRANSPARENCY 100 | ||
| 253 | TYPE POLYGON | 212 | TYPE POLYGON |
| 254 | - UNITS METERS | ||
| 255 | CLASS | 213 | CLASS |
| 256 | NAME " " | 214 | NAME " " |
| 257 | STYLE | 215 | STYLE |
| 258 | COLOR 232 220 201 | 216 | COLOR 232 220 201 |
| 259 | - MAXSIZE 100 | ||
| 260 | - MINSIZE 1 | ||
| 261 | - SIZE 1 | ||
| 262 | - SYMBOL 0 | ||
| 263 | END | 217 | END |
| 264 | END | 218 | END |
| 265 | END | 219 | END |
classesphp/mapa_googlemaps.php
| @@ -294,33 +294,10 @@ else{ | @@ -294,33 +294,10 @@ else{ | ||
| 294 | $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; | 294 | $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; |
| 295 | $img->saveImage($nomer); | 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 | header('Content-Type: image/png'); | 298 | header('Content-Type: image/png'); |
| 312 | - print($img); | ||
| 313 | - ob_end_flush(); | 299 | + fpassthru(fopen($nomer, 'rb')); |
| 314 | exit; | 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 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | 302 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 326 | global $img,$map_size; | 303 | global $img,$map_size; |
| @@ -352,59 +329,11 @@ function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | @@ -352,59 +329,11 @@ function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | ||
| 352 | {$nome = $cachedir."/googlemaps/".$layer."/".$nome;} | 329 | {$nome = $cachedir."/googlemaps/".$layer."/".$nome;} |
| 353 | if(file_exists($nome)) | 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 | header('Content-Type: image/png'); | 333 | header('Content-Type: image/png'); |
| 370 | - print($img); | ||
| 371 | - ob_end_flush(); | 334 | + fpassthru(fopen($nome, 'rb')); |
| 372 | exit; | 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 | function nomeRand($n=10) | 338 | function nomeRand($n=10) |
| 410 | { | 339 | { |
classesphp/mapa_openlayers.php
| @@ -268,34 +268,10 @@ else{ | @@ -268,34 +268,10 @@ else{ | ||
| 268 | $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; | 268 | $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; |
| 269 | $img->saveImage($nomer); | 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 | header('Content-Type: image/png'); | 272 | header('Content-Type: image/png'); |
| 286 | - print($img); | ||
| 287 | - ob_end_flush(); | 273 | + fpassthru(fopen($nomer, 'rb')); |
| 288 | exit; | 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 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | 276 | function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 301 | global $img,$map_size; | 277 | global $img,$map_size; |
| @@ -309,10 +285,10 @@ function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | @@ -309,10 +285,10 @@ function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | ||
| 309 | {$cachedir = dirname(dirname($map))."/cache/".$layer;} | 285 | {$cachedir = dirname(dirname($map))."/cache/".$layer;} |
| 310 | else | 286 | else |
| 311 | {$cachedir = $cachedir."/".$layer;} | 287 | {$cachedir = $cachedir."/".$layer;} |
| 312 | - @mkdir($cachedir,0777); | ||
| 313 | $nome = $cachedir."/".$w.$h.$bbox.".png"; | 288 | $nome = $cachedir."/".$w.$h.$bbox.".png"; |
| 314 | if(!file_exists($nome)) | 289 | if(!file_exists($nome)) |
| 315 | { | 290 | { |
| 291 | + @mkdir($cachedir,0777); | ||
| 316 | $img->saveImage($nome); | 292 | $img->saveImage($nome); |
| 317 | chmod($nome,0777); | 293 | chmod($nome,0777); |
| 318 | } | 294 | } |
| @@ -330,61 +306,31 @@ function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | @@ -330,61 +306,31 @@ function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | ||
| 330 | {$nome = $cachedir."/".$layer."/".$nome;} | 306 | {$nome = $cachedir."/".$layer."/".$nome;} |
| 331 | if(file_exists($nome)) | 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 | ob_start(); | 318 | ob_start(); |
| 334 | // assuming you have image data in $imagedata | 319 | // assuming you have image data in $imagedata |
| 335 | $img = file_get_contents($nome); | 320 | $img = file_get_contents($nome); |
| 336 | $length = strlen($img); | 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 | header('Accept-Ranges: bytes'); | 322 | header('Accept-Ranges: bytes'); |
| 346 | header('Content-Length: '.$length); | 323 | header('Content-Length: '.$length); |
| 347 | header('Content-Type: image/png'); | 324 | header('Content-Type: image/png'); |
| 348 | print($img); | 325 | print($img); |
| 349 | ob_end_flush(); | 326 | ob_end_flush(); |
| 350 | exit; | 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 | exit; | 332 | exit; |
| 386 | } | 333 | } |
| 387 | - */ | ||
| 388 | } | 334 | } |
| 389 | function nomeRand($n=10) | 335 | function nomeRand($n=10) |
| 390 | { | 336 | { |