예제 #1
0
 public function sort()
 {
     $this->finder->files()->in($this->srcPath);
     $fileManager = new FileManager();
     $directoryManager = new DirectoryManager();
     $countImg = 0;
     $count = 0;
     foreach ($this->finder as $file) {
         $systemFile = new SystemFile($file->getRealpath());
         if (strpos($systemFile->getMimeType(), 'image') !== false) {
             $image = new Image($systemFile);
             $newFolder = $directoryManager->createFolderFromDate($this->destPath, $image->getCreationDate());
             $fileManager->copyFile($image, $newFolder, true);
             unset($image);
             $countImg++;
         } else {
             unset($systemFile);
         }
         if ($count % 500 === 0) {
             echo "Checked Files : " . $count . "\n";
         }
         $count++;
     }
     unset($fileManager);
     unset($directoryManager);
     echo "====================================\n";
     echo "Ende     : " . date("H:i", time()) . "\n";
     echo "Files    : " . $count . "\n";
     echo "ImgFiles : " . $countImg . "\n";
     echo "====================================\n";
 }
예제 #2
0
 /**
  * @Route("/{path}", name="open_dir", requirements={"path"=".+"})
  * @Template("PictureGalleryBundle:Gallery:index.html.twig")
  */
 public function openAction($path)
 {
     $directoryPath = $this->getParameter('directory_path');
     $dirManager = new DirectoryManager();
     //        die("<pre>".print_r($path, 1)."</pre>");
     if (!empty($path) && substr($path, -1) !== "/") {
         $path .= "/";
     }
     return array("pathback" => $path . "..", "directorypath" => $directoryPath, "directories" => $dirManager->getFolderContent($directoryPath, $path));
 }