Location: PHPKode > projects > PhpBlock > A9.8/script/satellitemap.php
<?php
include_once $PATH_TO_CODE."/script/connect.php";
include_once "../site.class.php";
include_once $PATH_TO_CODE."/script/fonction.php";
include_once $PATH_TO_CODE."/script/block.class.php";
include_once $PATH_TO_CODE."/script/log.class.php";

if(!isset($_GET["x"])) {
    $locCurrentCenterX = 500;
    $locCurrentCenterY = 500;
} else {
    $locCurrentCenterX = $_GET["x"];
    $locCurrentCenterY = $_GET["y"];
}

//Log::getInstance()->isDebugOn=true;

//Toujours impaire
$locImageWidthCount = 9;
//Toujours impaire
$locImageHeightCount = 7;
$locImageHalfWidthCount=(int)($locImageWidthCount/2);
$locImageHalfHeightCount = (int)($locImageHeightCount/2);

$locImageBlockSize=40;
$locImageSizeWidth=$locImageBlockSize*$locImageWidthCount;
$locImageSizeHeight=$locImageBlockSize*$locImageHeightCount;

global $gloObjectManager;

$locImgMinimap = imagecreatetruecolor($locImageSizeWidth, $locImageSizeHeight);

$locImageCount = 0;
$locTopInPixel = 0;
for($locY =  $locCurrentCenterY+$locImageHalfHeightCount*Constante::$BLOCK_SIZE;
    $locY >= $locCurrentCenterY-$locImageHalfHeightCount*Constante::$BLOCK_SIZE;
    $locY -= Constante::$BLOCK_SIZE) {
    $locLeftInPixel = 0;
    for($locX  = $locCurrentCenterX-$locImageHalfWidthCount*Constante::$BLOCK_SIZE;
        $locX <= $locCurrentCenterX+$locImageHalfWidthCount*Constante::$BLOCK_SIZE;
        $locX += Constante::$BLOCK_SIZE) {
        $locBlockId = Block::getBlockIdWithCenterCoord($locX, $locY);
        if(Block::exist($locBlockId)) {
            $locArray = array(Constante::$MAP_MODE_SATELLITE_VIEW);
            $locBlock = $gloObjectManager->getBlock($locBlockId);
            $locBlockImage = $locBlock->getImage($locImageBlockSize, $locArray);
            imagecopy($locImgMinimap, $locBlockImage, $locLeftInPixel, $locTopInPixel, 0, 0, $locImageBlockSize, $locImageBlockSize);
        }
        $locLeftInPixel+=$locImageBlockSize;
    }
    $locTopInPixel+=$locImageBlockSize;
}
header("Content-Type: image/png");
header("Expires: ".date("r", time()+3600*24*7));

ImagePng($locImgMinimap);
ImageDestroy($locImgMinimap);
?>
Return current item: PhpBlock