Example #1
0
 /**
  * Searches the filesystem for the image based on the path,
  * or returns the default image if not found.
  *
  * @param string $path
  *
  * @return Image
  */
 public function find($path)
 {
     foreach ($this->filesystemsToCheck as $prefix) {
         $fs = $this->filesystem->getFilesystem($prefix);
         $image = $fs->getImage($path);
         if ($image->exists()) {
             return $image;
         }
     }
     return $this->defaultImage;
 }
Example #2
0
 /**
  * Clear the cache. Both the doctrine FilesystemCache, as well as twig and thumbnail temp files.
  *
  * @return bool
  */
 protected function doFlush()
 {
     // Clear Doctrine's folder.
     $result = parent::doFlush();
     if ($this->filesystem instanceof AggregateFilesystemInterface) {
         // Clear our own cache folder.
         $this->flushDirectory($this->filesystem->getFilesystem('cache')->getDir('/'));
         // Clear the thumbs folder.
         $this->flushDirectory($this->filesystem->getFilesystem('web')->getDir('/thumbs'));
     }
     return $result;
 }
Example #3
0
 /**
  * Clear the cache. Both the doctrine FilesystemCache, as well as twig and thumbnail temp files.
  *
  * @return array
  */
 public function doFlush()
 {
     $result = ['successfiles' => 0, 'failedfiles' => 0, 'failed' => [], 'successfolders' => 0, 'failedfolders' => 0, 'log' => ''];
     // Clear Doctrine's folder.
     parent::doFlush();
     if ($this->filesystem instanceof AggregateFilesystemInterface) {
         // Clear our own cache folder.
         $this->flushFilesystemCache($this->filesystem->getFilesystem('cache'), $result);
         // Clear the thumbs folder.
         $this->flushFilesystemCache($this->filesystem->getFilesystem('thumbs'), $result);
     }
     return $result;
 }