Note that this repository is not part of the public API. Use the asset's getThumbnail() method instead.
Inheritance: extends Neos\Flow\Persistence\Repository
コード例 #1
0
 /**
  * Refreshes a thumbnail and persists the thumbnail
  *
  * @param Thumbnail $thumbnail
  * @return void
  */
 public function refreshThumbnail(Thumbnail $thumbnail)
 {
     $thumbnail->refresh();
     $this->persistenceManager->whiteListObject($thumbnail);
     if (!$this->persistenceManager->isNewObject($thumbnail)) {
         $this->thumbnailRepository->update($thumbnail);
     }
 }
コード例 #2
0
 /**
  * Render ungenerated thumbnails
  *
  * Loops over ungenerated thumbnails and renders them. Optional ``limit`` parameter to limit the amount of
  * thumbnails to be rendered to avoid memory exhaustion.
  *
  * @param integer $limit Limit the amount of thumbnails to be rendered to avoid memory exhaustion
  * @return void
  */
 public function renderThumbnailsCommand($limit = null)
 {
     $thumbnailCount = $this->thumbnailRepository->countUngenerated();
     $iterator = $this->thumbnailRepository->findUngeneratedIterator();
     $this->output->progressStart($limit !== null && $thumbnailCount > $limit ? $limit : $thumbnailCount);
     $iteration = 0;
     foreach ($this->thumbnailRepository->iterate($iterator) as $thumbnail) {
         if ($thumbnail->getResource() === null) {
             $this->thumbnailService->refreshThumbnail($thumbnail);
             $this->persistenceManager->persistAll();
         }
         $this->output->progressAdvance(1);
         $iteration++;
         if ($iteration === $limit) {
             break;
         }
     }
 }