listImages() public method

Lists a slice of the image ids in this gallery.
public listImages ( integer $from, integer $count ) : array
$from integer The image to start listing.
$count integer The numer of images to list.
return array An array of image_ids
Exemplo n.º 1
0
 /**
  * Empties a gallery of all images.
  *
  * @param Ansel_Gallery $gallery  The ansel gallery to empty.
  *
  * @throws Ansel_Exception
  */
 public function emptyGallery(Ansel_Gallery $gallery)
 {
     $gallery->clearStacks();
     $images = $gallery->listImages();
     foreach ($images as $image) {
         // Pretend we are a stack so we don't update the images count
         // for every image deletion, since we know the end result will
         // be zero.
         try {
             $gallery->removeImage($image, true);
         } catch (Horde_Exception_NotFound $e) {
             // Don't worry about missing images since we are deleting them
             // anyway.
             Horde::log($e->getMessage(), 'ERR');
         }
     }
     $gallery->set('images', 0, true);
     // Clear the OtherGalleries widget cache
     if ($GLOBALS['conf']['ansel_cache']['usecache']) {
         $GLOBALS['injector']->getInstance('Horde_Cache')->expire('Ansel_OtherGalleries' . $gallery->get('owner'));
         $GLOBALS['injector']->getInstance('Horde_Cache')->expire('Ansel_Gallery' . $gallery->id);
     }
 }