Exemple #1
0
 public function onNewFile(array $info)
 {
     parent::onNewFile($info);
     $meta = GenericMetadataReader::readMetadata($info['filePath']);
     $this->extraData = $this->getInformationToKeep($meta, $meta['mime_type']);
     if (isset($this->extraData['exif']['IFD0']['Artist'])) {
         $this->author = $this->extraData['exif']['IFD0']['Artist'];
     }
 }
Exemple #2
0
 public function onNewFile(array $info)
 {
     parent::onNewFile($info);
     $meta = GenericMetadataReader::readMetadata($info['filePath']);
     $this->extraData = $this->getInformationToKeep($meta, $meta['mime_type']);
     if (isset($this->extraData['artist'][0])) {
         $this->author = $this->extraData['artist'][0];
     } elseif (isset($this->extraData['band'][0])) {
         $this->author = $this->extraData['band'][0];
     }
     if (isset($this->extraData['title'][0])) {
         $title = $this->extraData['title'][0];
         if (isset($this->extraData['album'][0])) {
             $title .= ' - ' . $this->extraData['album'][0];
         }
         $this->title = $title;
     }
 }
Exemple #3
0
 public function onNewFile(array $info)
 {
     parent::onNewFile($info);
     $files = [];
     switch ($info['fileMimeType']) {
         case 'application/x-gzip':
         case 'application/x-tar':
         case 'application/x-gtar':
             try {
                 $tar = new \PharData($info['filePath']);
             } catch (\UnexpectedValueException $e) {
                 break;
             }
             $this->setNumberOfFiles($tar->count());
             $i = 0;
             foreach ($tar as $file) {
                 $files[] = $file;
                 if ($i >= 1000) {
                     break;
                 }
                 $i++;
             }
             break;
         case 'application/x-zip-compressed':
         case 'application/zip':
         case 'multipart/x-zip':
             $zip = new \ZipArchive();
             $zip->open($info['filePath']);
             $this->setNumberOfFiles($zip->numFiles);
             for ($i = 0; $i < $zip->numFiles && $i < 1000; $i++) {
                 $file = $zip->statIndex($i);
                 $files[] = $file['name'];
             }
             break;
         default:
             throw new \LogicException();
     }
     $this->extraData['files'] = $files;
 }
 public function getOriginalWithWatermark(AbstractFileEntity $entity, $mode, $optimize = true)
 {
     switch ($mode) {
         case 'path':
             return $entity->getPath();
         case 'url':
             return $entity->getUrl();
         default:
             throw new \LogicException();
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->setUseSyntaxHighlighting(true);
 }