PHP code example of hirasso / focal-point-picker

1. Go to this page and download the library: Download hirasso/focal-point-picker 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/ */

    

hirasso / focal-point-picker example snippets


$focalPoint = fcp_get_focalpoint($imageID);
var_dump($focalPoint);



$imageID = 1234;
$imageSRC = wp_get_attachment_image_src($imageID, 'large');
$focus = fcp_get_focalpoint($imageID);




$imageID = 1234;
$imageSRC = wp_get_attachment_image_src($imageID, 'large');
$focus = fcp_get_focalpoint($imageID);


use Hirasso\FocalPointPicker\Position;

/** center top. Great for preserving faces in cropped images */
add_filter(
    'hirasso/fcp/default-position',
    fn() => new Position(left: 0.5, top: 0)
);

/** or simply: */
add_filter(
    'hirasso/fcp/default-position',
    fn() => new Position(top: 0)
);

/** etc... */