propresenter-php/php/bin/regen-test-bundles.php
Thorsten Bus deabfe4ffb feat(bundle): add .probundle reader, writer, and wrapper for presentation bundles
ProPresenter .probundle files are ZIP archives containing a single .pro
presentation with embedded media assets. This adds read/write support
verified against actual ProPresenter 7 exports.

- PresentationBundle: wrapper class (Song + media files + .pro filename)
- ProBundleReader: reads .probundle ZIPs, applies Zip64Fixer for PP exports
- ProBundleWriter: writes standard ZIP with media-first entry order
- ProFileGenerator: media URLs now include URL.local with LocalRelativePath
- 9 tests covering error handling, round-trip, PP export compat, ZIP format
- ref/TestBild.probundle: verified importable by ProPresenter 7
2026-03-30 08:58:48 +02:00

42 lines
1.3 KiB
PHP

<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use ProPresenter\Parser\PresentationBundle;
use ProPresenter\Parser\ProBundleWriter;
use ProPresenter\Parser\ProFileGenerator;
$image = imagecreatetruecolor(200, 150);
$blue = imagecolorallocate($image, 30, 60, 180);
imagefill($image, 0, 0, $blue);
$white = imagecolorallocate($image, 255, 255, 255);
imagestring($image, 5, 10, 10, 'ProPresenter', $white);
$tmpPng = tempnam(sys_get_temp_dir(), 'testbild-') . '.png';
imagepng($image, $tmpPng);
$imageBytes = file_get_contents($tmpPng);
unlink($tmpPng);
$refDir = dirname(__DIR__, 2) . '/ref';
$mediaAbsPath = '/Users/thorsten/AI/propresenter/ref/Media/test-background.png';
$song = ProFileGenerator::generate(
'TestBild',
[
[
'name' => 'Verse 1',
'color' => [0.0, 0.0, 0.0, 1.0],
'slides' => [
[
'media' => 'file://' . $mediaAbsPath,
'format' => 'png',
],
],
],
],
[['name' => 'normal', 'groupNames' => ['Verse 1']]],
);
$bundle = new PresentationBundle($song, 'TestBild.pro', [$mediaAbsPath => $imageBytes]);
ProBundleWriter::write($bundle, $refDir . '/TestBild.probundle');
echo "TestBild.probundle written\n";