Exemplo n.º 1
0
 public function importFiles($fromPath, $computeThumbnails = true)
 {
     $fh = new Importer();
     if (!$computeThumbnails) {
         $fh->setRescanThumbnailsOnImport(false);
         $helper = Core::make('helper/file');
     }
     $contents = Core::make('helper/file')->getDirectoryContents($fromPath);
     foreach ($contents as $filename) {
         if (!is_dir($filename)) {
             $fv = $fh->import($fromPath . '/' . $filename, $filename);
             if (!$computeThumbnails) {
                 $types = \Concrete\Core\File\Image\Thumbnail\Type\Type::getVersionList();
                 foreach ($types as $type) {
                     // since we provide the thumbnails, we're going to get a list of thumbnail types
                     // and loop through them, assigning them to all the files.
                     $thumbnailPath = $fromPath . '/' . $type->getHandle() . '/' . $filename;
                     if (file_exists($thumbnailPath)) {
                         $fv->importThumbnail($type, $thumbnailPath);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public function setRescanThumbnailsOnImport($refresh)
 {
     return parent::setRescanThumbnailsOnImport($refresh);
 }