WP Manifestindependent plugin directory
manifest / media / focal-point-picker

Focal Point Picker WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA #10 in Media & Images

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

★ 43stars
15kcomposer installs
v1.4.1latest · 29d ago

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/hirasso/focal-point-picker/archive/refs/heads/main.zip

On Packagist as hirasso/focal-point-picker:

composer require hirasso/focal-point-picker
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

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

CleanShot 2024-06-24 at 15 18 15@2x

Installation

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:

  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

Data structure

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

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

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

Object Position

<?php

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

?>

<style>
#my-image {
  height: 300px;
  width: 600px;
  position: relative;
}
#my-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
</style>

<div id="my-image">
  <img
    src="<?= $imageSRC[0] ?>"
    style="object-position: <?= $focus->leftPercent ?? 50 ?>% <?= $focus->topPercent ?? 50 ?>%;">
</div>

Background Position

<?php

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

?>

<style>
#my-image {
  background-image: url('<?php echo $imageSRC[0]; ?>');
  background-size: cover;
  height: 300px;
  width: 600px;
}
</style>

<div
  id="my-image"
  style="background-position: <?= $focus->leftPercent ?? 50 ?>% <?= $focus->topPercent ?? 50 ?>%;">
</div>

Using wp_get_attachment_image

If you are making use of the WordPress function wp_get_attachment_image(), the plugin will automatically inject a class focal-point-image and two custom css properties for you to use:

<img
  width="150"
  height="150"
  src="http://example.com/wp-content/uploads/bear-150x150.png"
+ class="attachment-thumbnail size-thumbnail focal-point-image"
  alt=""
  decoding="async"
  loading="lazy"
+ style="--focal-point-left: 0.46; --focal-point-top: 0.2"
>

You can use that like this, for example:

.focal-point-image {
  aspect-ratio: 16/7; /** or whatever you like */
  height: auto;
  object-fit: cover;
  object-position:
    calc(var(--focal-point-left, 0.5) * 100%)
    calc(var(--focal-point-top, 0.5) * 100%);
}

Filters

The default position of the focal point can be customized using filters:

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... */

This might come in handy if you have many photographs where the eyes of people are at the top of the image somewhere and you don't want to adjust them all manually.

WP_CLI Interface

fcp apply-default-position

Apply the default position to existing images:

# apply the default position to a selection of images:
wp fcp apply-default-position 23 42 999

# apply the default position to ALL of your images:
wp fcp apply-default-position --all

# apply the default position to ALL of your images, skipping the confirmation prompt (for scripting)
wp fcp apply-default-position --all --yes

Releases

17 releases.

Tag
Published
v1.4.1 latest
Sep 23, 2026 29d ago
Oct 30, 2025 11mo ago
Feb 14, 2025 1 year ago
Feb 11, 2025 1 year ago
Feb 6, 2025 1 year ago
Jan 17, 2025 1 year ago
Jan 17, 2025 1 year ago
Jan 17, 2025 1 year ago
Oct 28, 2024 1 year ago
Jul 25, 2024 2 years ago
Jul 24, 2024 2 years ago
Jul 24, 2024 2 years ago
Jul 23, 2024 2 years ago
Jul 23, 2024 2 years ago
Jul 22, 2024 2 years ago
Jul 19, 2024 2 years ago
Jul 11, 2024 2 years ago

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.

A grade

Security

Focal Point Picker 1.4.1 · audited by WP Registry

No security issues found.

Audited release
1.4.1
Findings
none
Worst severity
—
Content hash
df34f600e7f394f56fedd704…

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.