Created
September 29, 2017 18:35
-
-
Save jawngee/eba64296c7cc4bc13bf4631e947c8b78 to your computer and use it in GitHub Desktop.
Passing detected faces to imgix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// not tested | |
// would go into your theme's functions.php | |
add_filter('ilab-imgix-filter-parameters',function($params, $size, $id, $meta){ | |
if (isset($meta['faces']) && is_array($meta['faces'])) { | |
$firstFace = $meta['faces'][0]; | |
$rect = $firstFace['BoundingBox']; | |
list($width, $height, $left, $top) = array_values($rect); | |
$params['not_sure_what_it_is'] = "$left,$top,$width,$height"; | |
} | |
return $params; | |
}, 10, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment