Ansel_Faces_Base::getFromGallery PHP Method

getFromGallery() public method

Get faces for all images in a gallery
public getFromGallery ( integer $gallery_id, boolen $create = false, boolen $force = false ) : array
$gallery_id integer The share_id/gallery_id of the gallery to check.
$create boolen Create faces and signatures or just store coordniates?
$force boolen Force recreation even if image has faces
return array Faces found
    public function getFromGallery($gallery_id, $create = false, $force = false)
    {
        $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($gallery_id);
        if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
            throw new Horde_Exception_PermissionDenied(_("Access denied editing this gallery."));
        }
        $images = $gallery->getImages();
        $faces = array();
        foreach ($images as $image) {
            if ($image->facesCount && $force == false) {
                continue;
            }
            $result = $this->getFromPicture($image, $create);
            if (!empty($result)) {
                $faces[$image->id] = $result;
            }
            unset($image);
        }
        return $faces;
    }