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']; } }
/** * {@inheritdoc} */ public function canUpload(UploadedFile $file) { $mimeType = $file->getMimeType(); if (in_array($mimeType, $this->getSupportedMimeTypes())) { return 5; } if ($file->getMimeType() == 'application/ogg') { // This could be a video or audio file. $meta = GenericMetadataReader::readMetadata($file->getPathname()); if (isset($meta['audio']['dataformat'])) { return 5; } } return 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; } }