4
I have a function that detects the position of the face of the person in an image and returns the X, Y, W, H or she can return the image cropped from the face.
I need to display a photo of a person and I’m currently doing:
<?= wp_get_attachment_image( 1497, 'custom-small-thumb' ) ?>
Right, it displays the photo using the classic Wordpress resize/cut function.
BUT what I REALLY NEED is to display only the face that appears in this image, and I did not want to gambiarra, I would like to use the maximum features of Wordpress for this purpose.
I have a function faceDetector($imagesrc)
and I wonder if there’s any hook I can make to run the faceDetector before the wp_get_attachment_image.
In fact i would like much of something like
<?= wp_get_attachment_image ( 1497, 'face-small-thumb' ) ?>
But WP does not let us pass a custom function on add_image_size.