propresenter-php/php/bin/regen-test-bundles.php
Thorsten Bus 8dbcc1bafc feat(bundle): use ROOT_CURRENT_RESOURCE for portable flat media bundles
BREAKING: Bundle media entries are now flat filenames (no directories).
ProBundleWriter flattens all media paths to basename() automatically.
ProFileGenerator supports bundleRelative flag for ROOT_CURRENT_RESOURCE
URLs, enabling bundles that work on any machine without absolute paths.
2026-03-30 10:21:54 +02:00

43 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';
$song = ProFileGenerator::generate(
'TestBild',
[
[
'name' => 'Verse 1',
'color' => [0.0, 0.0, 0.0, 1.0],
'slides' => [
[
'media' => 'test-background.png',
'format' => 'png',
'label' => 'test-background.png',
'bundleRelative' => true,
],
],
],
],
[['name' => 'normal', 'groupNames' => ['Verse 1']]],
);
$bundle = new PresentationBundle($song, 'TestBild.pro', ['test-background.png' => $imageBytes]);
ProBundleWriter::write($bundle, $refDir . '/TestBild.probundle');
echo "TestBild.probundle written\n";