PHP code example of addequatte / photo-box-centering
1. Go to this page and download the library: Download addequatte/photo-box-centering 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/ */
addequatte / photo-box-centering example snippets
/**
* public/index.php
*/
use Addequatte\PhotoBoxCentering\Data\PositionedBox;
use Addequatte\PhotoBoxCentering\Data\TranslatePlan;
use Addequatte\PhotoBoxCentering\Service\PhotoTranslator;
T['h'] ?? 200;
$targetBoxPercent = $_GET['p'] ?? 40;
$translatePlan = new TranslatePlan($photoWidth, $photoHeight, $targetWidth, $targetHeight, $targetBoxPercent);
// Face coordinates on photo
$positionedBox = new PositionedBox(635, 100, 785, 315);
$photoTranslator = new PhotoTranslator();
$translatePhoto = $photoTranslator->center($translatePlan, $positionedBox);
$translateX = $translatePhoto->translateX();
$translateY = $translatePhoto->translateY();
$scale = $translatePhoto->scale();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.