Battle Empire map section has a preview possibility that creates an image of maps that have been created with the Map Editor written in BlitzPlus.
Not Battle Empire compatible functions(just to show how it can be done in PHP):
Not Battle Empire compatible functions(just to show how it can be done in PHP):
$TileSize = 32; $file = fopen('map.map', 'rb'); if($file){ //Header... $Width = FReadShort($file); $Height = FReadShort($file); $MapName = FReadString($file); $MapAuthor = FReadString($file); // ...and so on // Create map image $thumb = imagecreatetruecolor($Width * $TileSize, $Height * $TileSize); // Load tile table $source = imagecreatefromjpeg('tiles.jpg'); // Draw tiles to map image for($y = 0; $y < $Height; $y++){ for($x = 0; $x < $Width; $x++){ imagecopyresized($thumb, $source, $x * $TileSize, $y * $TileSize, FReadByte($file) * $TileSize, 0, $TileSize, $TileSize, $TileSize, $TileSize); } } // Output (will send the map image) imagejpeg($thumb); } function FReadString($file){ $a = fread($file, 4); $len = ord(substr($a, 0, 1)) + ord(substr($a, 1, 1)) * 255 + ord(substr($a, 2, 1)) * 255 * 255 + ord(substr($a, 3, 1)) * 255 * 255 * 255; if($len > 0){$txt = fread($file, $len);}else{$txt = '';} return $txt; } function FReadShort($file){ $a = fread($file, 2); return ord(substr($a, 0, 1)) + ord(substr($a, 1, 1)) * 255; } function FReadByte($file){ $a = fread($file, 1); return ord($a); }