public function getFaces(Ansel_Image $image)
{
if ($image instanceof Ansel_Image) {
// First check if screen view exists
$image->load('screen');
// Make sure we have an on-disk copy of the file.
$file = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen'));
} else {
$file = $image;
}
if (empty($file)) {
return array();
}
// Get faces from driver
$faces = $this->_getFaces($file);
if (empty($faces)) {
return array();
}
// Remove faces containg faces
// for example when 2 are together we can have 3 faces
foreach ($faces as $face) {
$id = $this->_isInFace($face, $faces);
if ($id !== false) {
unset($faces[$id]);
}
}
return $faces;
}