For developers
Works with your theme. Even better with a line of PHP.
Images from wp_get_attachment_image(), srcset, your content and the block editor go through Focalio automatically. When you want full control, the helpers are there.
Focalio needs PHP 8.3 or newer, WordPress 6.2 or newer, and the Imagick or GD extension.
Without writing code
Install Focalio and your theme's images are already served by it, cropped on the focal point you chose in the Media Library.
wp_get_attachment_image(),the_post_thumbnail()and srcset: every size comes from Focalio, on demand.- Images in posts and pages, when they show the attachment. An image block with an aspect ratio gets a real crop on the focal point.
- Cover and Media & Text blocks: their image position follows the focal point.
- The block editor: a Focalio panel for the Image block, a Cover with an image background and Media & Text with an image. On WordPress 7.1 the editor's own Crop buttons open Focalio's editor.
<?php
the_post_thumbnail('large');
echo wp_get_attachment_image($id, 'medium_large');In WordPress
What Focalio adds to the WordPress admin, and below it what Focalio Pro adds to the same screens.





With Focalio Pro Pro
The same screens with Pro active: a few extra controls where you set the focal point, and tabs and settings of its own.








The photo: Bruce McCandless II on the first untethered spacewalk, 1984. NASA, public domain.
In templates
glide_image() renders a responsive <img> for any ratio: srcset, lazy loading, and a blurred placeholder if you want one.
Named arguments use the parameter names as they are in PHP: maxWidth:, not max_width:. The helpers start with glide_ and some filters with wp_glide/: names from before Focalio had its name, kept so existing code keeps working.
<?php
echo glide_image(
get_post_thumbnail_id(),
'16:9',
lazy: false,
priority: true,
);Parameters glide_image()
- $imageint|array|string|null
- Attachment ID or ACF image array (with its focal point, alt text and placeholder), a path relative to the uploads folder or an uploads URL (as it is).
nullgives an empty string. - $aspectstring
- The ratio as W:H, like 16:9, or the name of a preset.
- $class?string = null
- The class attribute of the
<img>. - $maxWidth?int = null
- The largest width in the srcset: lower than the Maximum width setting if you like, never above it or the original's.
- $sizes?string = null
- The sizes attribute. By default
100vw. - $lazybool = true
loading="lazy"anddecoding="async". Turn it off for the largest image at the top of the page.- $prioritybool = false
fetchpriority="high", for that same image.- $quality?int = null
- Image quality, up to 100. By default the preset's quality, else the site's.
- $lqip?bool = null
- The blurred placeholder while loading.
nullfollows the preset, else the site. For attachment IDs and ACF image arrays.
An aspect that is neither W:H nor a preset throws an InvalidArgumentException; so does a 0 in the ratio, and preset names are case-sensitive. A missing image gives an empty string, whatever the aspect.
glide_source() gives the <source> for a <picture>, to show another ratio on small screens.
<picture>
<?= glide_source($id, '1:1', media: '(max-width: 767px)') ?>
<?= glide_image($id, '16:9', 'w-full') ?>
</picture>glide_url() returns just the address of a rendition, or null for a missing image. With fit=crop it crops an attachment ID on the focal point. glide_placeholder() returns the blurred placeholder as a data URI, or null.
<?php
$url = glide_url($id, ['w' => 600, 'h' => 600, 'fit' => 'crop']);
$blur = glide_placeholder($id, '1:1');Presets
Name a ratio once, with its own quality and placeholder, and templates stay short. Register it in your theme's functions.php or a plugin, or add it under Focalio, Presets in the admin.
A preset has an aspect ratio, a quality (40 to 100; leave it out for the site's setting) and a placeholder setting (true, false, or null to follow the site). Names are lowercase letters, digits, - and _, up to 32 characters, starting and ending with a letter or digit; capitals and spaces become lowercase and hyphens.
<?php
glide_register_preset('hero', '21:9', quality: 80, lqip: true);Use it by name in glide_image() and glide_source(), or as a WordPress image size: in wp_get_attachment_image(), in the block editor's resolution menu and in ACF. No files are written for it.
<?php
echo glide_image($id, 'hero');
echo wp_get_attachment_image($id, 'hero');The same with a filter, if you prefer it. Presets from code win over the ones made in the admin.
add_filter('wp_glide/register_presets', function (array $presets): array {
$presets['hero'] = ['aspect' => '21:9', 'quality' => 80];
return $presets;
});WP-CLI
Look into the image cache, clean it up or empty it, and work out focal points in bulk.
- wp focalio cache stats
- How many rendered images are in the cache, and how many the cleanup would remove.
- wp focalio cache cleanup [--dry-run]
- Run the weekly cleanup now; with
--dry-runit only counts. It stops after 20 seconds: run it again for the rest. - wp focalio cache clear [--yes]
- Delete every rendered image. Asks first, unless you add
--yes. Your originals are never touched. - wp focalio guess [--force]
- Work out the automatic focal point (entropy or attention, as set) of every image ahead of time;
--forceredoes the ones already known. Not when the automatic point is set to the centre.
$ wp focalio cache stats
$ wp focalio cache cleanup --dry-run
$ wp focalio cache clear --yes
$ wp focalio guess --forceConfiguration
The settings have filters, for when a value belongs in code. A few useful ones:
add_filter('wp_glide/max_width', fn () => 1920);
add_filter('focalio/cache_max_age_days', fn () => 90);| Filter | Default | What it does |
|---|---|---|
| wp_glide/max_width | 2560 | The largest width in a srcset: the Settings tab's value |
| wp_glide/quality | 82 | Image quality: the Settings tab's value, 82 out of the box |
| wp_glide/format | 'webp' | webp or avif: the Settings tab's value |
| wp_glide/default_format | The format added to an address that asks for none ($path); '' keeps the source's. Animated GIFs always keep theirs | |
| wp_glide/lqip | false | Blurred placeholders across the site: the Settings tab's value |
| wp_glide/route_prefix | 'img' | The first part of image addresses (/img/…) |
| wp_glide/cache_path | uploads/.glide-cache | Where rendered images are kept |
| wp_glide/driver | 'imagick' | 'gd' | imagick, else gd |
| focalio/image_params | The last word on an image's parameters (array $params, int $id, ?array $transform, string $context) | |
| focalio/cache_max_age_days | 180 | Days before the weekly cleanup removes a rendered image; 0 keeps them |
| focalio/virtual_sizes_keep | ['thumbnail'] | Sizes still saved on upload when Image sizes on upload is on |
| focalio/early_serve | true | Serve cached images before WordPress loads; false from a must-use plugin, like FOCALIO_EARLY_SERVE |
| focalio/replace_image_editor | true | On WordPress 7.1, the block editor's Crop buttons open Focalio's editor; false gives back WordPress's own |
Image addresses are signed, so nobody can ask your server for any size they like: a wrong signature gets a 403. Focalio makes the key itself. Define GLIDE_SIGN_KEY to keep it the same across environments; Focalio, Security shows the line to paste.
Focalio serves images it has already made before WordPress loads, which is what makes them fast. FOCALIO_EARLY_SERVE set to false turns that off: in wp-config.php or a must-use plugin, because it's read while plugins load. The focalio/early_serve filter does the same.
define('GLIDE_SIGN_KEY', 'your-own-long-random-key');
define('FOCALIO_EARLY_SERVE', false);What Pro adds Pro
Focalio Pro is an add-on to the plugin above. Your templates stay as they are: Pro adds to what they render. It comes with a licence, not as a download from this site.
- Zoom, straighten and a crop of your own per ratio, set per image in the Media Library.
glide_image(),glide_url()andwp_get_attachment_image()follow them by themselves. Inglide_url(), a crop you pass yourself (crop-x-y-zoom) is left alone, and passing st or mark leaves out the straightening or the watermark. - Version history per image: every change to the focal point, orientation, zoom, angle, crops and watermark choice, the last 20, with a thumbnail each. Go back and forward, like undo and redo.
- AVIF with WebP as a fallback: images in your content and from
wp_get_attachment_image()get a<picture>with AVIF.glide_image()andglide_source()keep giving WebP. - A watermark from the Media Library: one of nine positions, a size, an opacity and a margin, left off small images. Leave it off per image or per preset.
- Changed images are rendered again by themselves: after an upload, or when the focal point, orientation, zoom, angle, a crop or the watermark changes. New uploads get their focal point on the faces.
- Four WP-CLI commands: render the cache ahead of the first visitor, put the focal point on faces, and export or import the settings.
- Import and export the settings, on a tab of their own or with WP-CLI, to copy them to another site. The sign key and the cache never go along.
- WooCommerce: a block theme's shop grid cropped on the focal point by itself, and a ratio for every photo on a product page.
- Multisite: a Focalio screen in the Network Admin with every site's cache and warm-up, a template site whose settings new sites can start with (or that you copy to every site at once), and one licence for the network. warm and faces take
--network. - Filters for themes:
focalio_pro/preset_watermarkleaves a preset out of the watermark,focalio_pro/woocommerce_cropleaves an image in a block theme's shop grid as WooCommerce made it.
$ wp focalio warm --images
$ wp focalio faces --dry-run
$ wp focalio warm --network
$ wp focalio settings export --file=focalio.json- wp focalio warm [--pages] [--images] [--network]
- Render every image ahead of time: the ones on your pages (
--pages), every preset and size (--images), or both. - wp focalio faces [--force] [--dry-run] [--network]
- Put the focal point on the faces in every image. Images with a focal point, or already looked at, are skipped unless
--force;--dry-runonly reports. - wp focalio settings export [--file=<file>]
- Write the settings as JSON to a file, or to the screen without
--file. - wp focalio settings import <file> [--dry-run]
- Read them from a file (or - for the input);
--dry-runshows what would change.
add_filter('focalio_pro/preset_watermark', function (?bool $choice, string $preset) {
return $preset === 'avatar' ? false : $choice;
}, 10, 2);
add_filter('focalio_pro/woocommerce_crop', function (bool $crop, int $id) {
return $id === 123 ? false : $crop;
}, 10, 2);The full Pro docs come with the plugin.
Questions?
Ask in the support forum on WordPress.org, or send us a message.