Examples

php_bw_load_replay

This sample loads the replay located in D:\StarCraft\maps\replays\MyReplay.rep (notice how backslashes are doubled) and displays the name of the map, the duration of the game and the name, race and APM of each player (including observers).

<?php
    $info 
php_bw_load_replay("D:\\StarCraft\\maps\\replays\\MyReplay.rep");
    if(
$info->ErrorCode != 0)
        die(
"Could not load the replay ! Message : " $info->ErrorString);
    echo 
"Game played on " $info->Map->Name;
    echo 
"<br>Duration : " $info->GameLength;
    echo 
"<br>Players info : <br>";
    foreach(
$info->Players as $player)
        echo 
$player->Name " : " $player->RaceName ", " $player->APM "APM.<br>";
?>
php_bw_jpg_from_scm_ratio

This sample generates a 1/8th high quality minimap of the map MyMap.scm located in D:\StarCraft\maps to a test.jpg file located in E:\MyWebSite\img and displays this image in the page. Only resources are rendered. The MPQ files are located in "F:\Program Files\Starcraft.

<?php
    $map 
php_bw_jpg_from_scm_ratio("F:\\Program Files\\Starcraft""D:\\StarCraft\\maps\\MyMap.scm""E:\\MyWebSite\\img\\test.jpg"8REPASM_HIGH_QUALITY70RENDER_RESOURCES);
    if(
$map->ErrorCode == 0)
        echo 
"<img src=\"test.jpg\" />";
    else
        echo 
"Error : " $map->ErrorString;
?>
php_bw_jpg_from_scm_dim

This sample generates a 128x128 low quality minimap of the map "Neo Lost Temple.scm" located in /home/users/taiche/StarCraft/maps to a test.jpg file located in /home/users/repasm/www/img and displays this image in the page. The MPQ files are located in /home/users/taiche/StarCraft. The other options are left by default. These settings are quite nice for generating thumbnails as the resulting image's size will barely be higher than 6 KB for a quality factor of 90 %, which is definitely enough.

<?php
    $map 
php_bw_jpg_from_scm_dim("/home/users/taiche/StarCraft""/home/users/taiche/StarCraft/maps/Neo Lost Temple.scm""/home/users/repasm/www/img/test.jpg"128);
    if(
$map->ErrorCode == 0)
        echo 
"<img src=\"test.jpg\" />";
    else
        echo 
"Error : " $map->ErrorString;
?>
php_bw_jpg_from_rep_ratio

This sample generates a full-size high quality minimap that can be found in the MyReplay.rep replay located in D:\StarCraft\maps\replays to a test.jpg file located in E:\MyWebSite\img and displays this image in the page. Everything is rendered. The MPQ files are located in "F:\Program Files\Starcraft. This will generate a HUGE image, hence the 50 % quality factor. This is quite pointless anyway, but is always fun to watch ;)

<?php
    $map 
php_bw_jpg_from_rep_ratio("F:\\Program Files\\Starcraft""D:\\StarCraft\\maps\\replays\\MyReplay.rep""E:\\MyWebSite\\img\\test.jpg"1REPASM_HIGH_QUALITY50);
    if(
$map->ErrorCode == 0)
        echo 
"<img src=\"test.jpg\" />";
    else
        echo 
"Error : " $map->ErrorString;
?>
php_bw_jpg_from_rep_dim

This sample generates a 1024x1024 high quality minimap of the map "Neo Lost Temple.scm" located in /home/users/taiche/StarCraft/maps to a test.jpg file located in /home/users/repasm/www/img and displays this image in the page. The MPQ files are located in /home/users/taiche/StarCraft. These settings are quite nice to display a decent picture of a map without generating a file too big (generally < 300 KB for 128x128 maps) and the quality level can be lowered a bit.

<?php
    $map 
php_bw_jpg_from_rep_dim("F:\\Program Files\\Starcraft""D:\\StarCraft\\maps\\replays\\MyReplay.rep""E:\\MyWebSite\\img\\test.jpg"1024REPASM_HIGH_QUALITY90);
    if(
$map->ErrorCode == 0)
        echo 
"<img src=\"test.jpg\" />";
    else
        echo 
"Error : " $map->ErrorString;
?>