PHP code example of ama-team / projection-framework
1. Go to this page and download the library: Download ama-team/projection-framework library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ama-team / projection-framework example snippets
use \AmaTeam\Image\Projection\Framework;
use \AmaTeam\Image\Projection\Framework\EncodingOptions;
use \AmaTeam\Image\Projection\Specification;
use \AmaTeam\Image\Projection\Image\Format;
$framework = new Framework();
$source = new Specification('equirect', 'tmp/uploads/source.jpg');
$target = new Specification(
'cube',
'static/pano/{f}/{x}/{y}.jpg',
new Box(512, 512) // tile size,
new Box(2, 2) // layout, amount of tiles horizontally and vertically
);
$options = (new EncodingOptions())->setQuality(0.9);
$framework->convert($source, $target, Format::JPEG, $options);
// only specified faces will be created
$filter = new FaceFilter('f', 'b');
$options = (new ConversionOptions())->setFilters([$filter]);
$framework
->getConverter()
->createConversion($source, $target, $options)
->run();
$fxaaProcessor = new FXAAProcessor();
$watermarkProcessor = new WatermarkProcessor();
$conversion = $framework
->getConverter()
->createConversion($source, $target);
// 50 is order in which processor will run, so it will run before
// watermark processor
->addProcessor(50, $fxaaProcessor)
->addProcessor(99, $watermarkProcessor);
->run();