Skip to content

linslin/PHP-BLP

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP-BLP

Blizzard BLP Image File Parser for PHP.

Requires GD & ImageMagick.

Currently supported:

  • BLP0 (Reign of Chaos Beta)
  • BLP1 (All other War3 versions)

Basic Example

<?php

require 'blp.php';

$blp_image = new BLPImage('war3mapMap.blp');

$blp_image->saveAs("war3mapMap.png");
$blp_image->saveAs("war3mapMap.jpg");

?>

Advanced Example

<?php

require 'blp.php';

try {
    $fname = 'war3mapMap.blp';
    $blpfile = new BLPImage($fname);
    
    // get imagick handle
    $image = $blpfile->image();

    // convert to jpeg
    $image->setImageFormat("jpeg");
    $image->writeImage('output.jpg');

    // convert to png
    $image->setImageFormat("png");
    $image->writeImage('output.png');

    // display the image
    header("Content-Type: image/png");
    echo $image->getImageBlob();

    $blpfile->close();

} catch (Exception $e) {
    echo 'BLPImage Exception: ',  $e->getMessage(), "\n";

    exit;
}

?>

Thanks to Dr Super Good for his BLP Specifications and help with bug fixes.

About

Blizzard BLP Image File Parser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%