Sulu\Bundle\MediaBundle\Entity\FileVersion::getSize PHP Méthode

getSize() public méthode

Get size.
public getSize ( ) : integer
Résultat integer
    public function getSize()
    {
        return $this->size;
    }

Usage Example

 /**
  * @param FileVersion $fileVersion
  * @param string $locale
  * @param string $dispositionType
  *
  * @return BinaryFileResponse
  */
 protected function getFileResponse($fileVersion, $locale, $dispositionType = ResponseHeaderBag::DISPOSITION_ATTACHMENT)
 {
     $cleaner = $this->get('sulu.content.path_cleaner');
     $fileName = $fileVersion->getName();
     $fileSize = $fileVersion->getSize();
     $storageOptions = $fileVersion->getStorageOptions();
     $mimeType = $fileVersion->getMimeType();
     $version = $fileVersion->getVersion();
     $path = $this->getStorage()->load($fileName, $version, $storageOptions);
     $response = new BinaryFileResponse($path);
     $pathInfo = pathinfo($fileName);
     // Prepare headers
     $disposition = $response->headers->makeDisposition($dispositionType, $fileName, $cleaner->cleanup($pathInfo['filename'], $locale) . '.' . $pathInfo['extension']);
     // Set headers
     $response->headers->set('Content-Type', !empty($mimeType) ? $mimeType : 'application/octet-stream');
     $response->headers->set('Content-Disposition', $disposition);
     $response->headers->set('Content-length', $fileSize);
     return $response;
 }
All Usage Examples Of Sulu\Bundle\MediaBundle\Entity\FileVersion::getSize