PHPackages                             hirasso/focal-point-picker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hirasso/focal-point-picker

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

hirasso/focal-point-picker
==========================

Zero-dependency custom focal point picker for your WordPress images 🎯

v1.4.0(8mo ago)417.8k↓55.6%5GPL-3.0-or-laterJavaScriptPHP &gt;=8.2CI passing

Since Jul 19Pushed 8mo ago3 watchersCompare

[ Source](https://github.com/hirasso/focal-point-picker)[ Packagist](https://packagist.org/packages/hirasso/focal-point-picker)[ GitHub Sponsors](https://github.com/hirasso)[ RSS](/packages/hirasso-focal-point-picker/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (6)Versions (18)Used By (0)

Focal Point Picker
==================

[](#focal-point-picker)

Zero-dependency custom focal point picker for your WordPress images 🎯

[![CleanShot 2024-06-24 at 15 18 15@2x](https://private-user-images.githubusercontent.com/869813/342352865-3717cedb-d1db-4192-b24d-9997e48432c9.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI2ODMwMDksIm5iZiI6MTc4MjY4MjcwOSwicGF0aCI6Ii84Njk4MTMvMzQyMzUyODY1LTM3MTdjZWRiLWQxZGItNDE5Mi1iMjRkLTk5OTdlNDg0MzJjOS5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNjI4JTJGdXMtZWFzdC0xJTJGczMlM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wvU05GLYrVATInTYemrvpHkueGQ)

Installation
------------

[](#installation)

### Via Composer (recommended):

[](#via-composer-recommended)

1. Install the plugin:

```
composer require hirasso/focal-point-picker
```

1. Activate the plugin manually or using WP CLI:

```
wp plugin activate focal-point-picker
```

### Manually:

[](#manually)

1. Download and extract the plugin
2. Copy the `focal-point-picker` folder into your `wp-content/plugins` folder
3. Activate the plugin via the plugins admin page – Done!
4. Handle updates via [afragen/git-updater](https://github.com/afragen/git-updater)

Data structure
--------------

[](#data-structure)

You can retrieve the focal point for an image like this:

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

### Output:

[](#output)

```
object(FocalPointPicker\FocalPoint)#2796 (4) {
  ["left"]=>
  float(0.5)
  ["top"]=>
  float(0.5)
  ["leftPercent"]=>
  float(50)
  ["topPercent"]=>
  float(50)
  ["x"]=>
  float(0.5)
  ["y"]=>
  float(0.5)
  ["xPercent"]=>
  float(50)
  ["yPercent"]=>
  float(50)
}

```

Usage in your templates
-----------------------

[](#usage-in-your-templates)

### Object Position

[](#object-position)

```
