Exemple #1
0
 /**
  * @return null|string
  */
 protected function getNewUrl()
 {
     $mediaRequest = $this->mediaRequest;
     $infoStorage = $this->mediaContext->getMediaInfoStorage();
     switch ($mediaRequest->getCdnType()) {
         case MediaRequest::TYPE_DOWNLOAD:
             return $infoStorage->getDownloadUrl($mediaRequest->getMediaId());
             break;
         case MediaRequest::TYPE_STREAM:
             return $infoStorage->getUrl($mediaRequest->getMediaId());
             break;
         case MediaRequest::TYPE_IMAGE:
             return $infoStorage->getImageUrl($mediaRequest->getMediaId(), $mediaRequest->getOperations());
             break;
         case MediaRequest::TYPE_ICON:
             return $infoStorage->getIconUrl($mediaRequest->getMediaId(), $mediaRequest->getOperations());
             break;
         case MediaRequest::TYPE_PREVIEW:
             return $infoStorage->getPreviewUrl($mediaRequest->getMediaId(), $mediaRequest->getOperations());
             break;
         default:
             return $infoStorage->getUrl($mediaRequest->getMediaId());
             break;
     }
     return null;
 }
Exemple #2
0
 /**
  * @param bool $writeSecureFile
  */
 public function __construct($writeSecureFile = false)
 {
     $this->mediaValidationHelper = $this->createMediaValidationHelper($writeSecureFile);
     $this->mediaUrlHelper = $this->createMediaUrlHelper($this->mediaValidationHelper);
     $mediaInfoStorage = $this->createMediaInfoStorage($this->mediaUrlHelper);
     $imageToolFactory = $this->createImageToolFactory();
     parent::__construct($mediaInfoStorage, $imageToolFactory);
 }
Exemple #3
0
 /**
  * @param MediaContext $mediaContext
  * @param string       $mediaId
  */
 public function __construct(MediaContext $mediaContext, $mediaId)
 {
     $this->mediaContext = $mediaContext;
     $this->mediaId = $mediaId;
     $this->mediaInfoStorageItem = $mediaContext->getMediaInfoStorage()->getItem($this->mediaId);
 }
Exemple #4
0
 /**
  * @return ImageTool
  */
 protected function getImageTool()
 {
     return $this->mediaContext->getImageTool();
 }