Пример #1
0
 /**
  * @param \Cms\Data\Media $media
  */
 protected function attachMediaUrls(&$media)
 {
     $config = Registry::getConfig();
     $maxWidth = $config->media->icon->maxWidth;
     $maxHeight = $config->media->icon->maxHeight;
     $mediaInfoStorage = $this->getMediaInfoStorage($media->getWebsiteid());
     $url = $mediaInfoStorage->getUrl($media->getId());
     $downloadUrl = $mediaInfoStorage->getDownloadUrl($media->getId());
     $iconUrl = $mediaInfoStorage->getPreviewUrl($media->getId(), array(array('maxsize', $maxWidth, $maxHeight)));
     $media->setUrl($url);
     $media->setDownloadUrl($downloadUrl);
     $media->setIconUrl($iconUrl);
 }
Пример #2
0
 /**
  * @param \Cms\Data\Media $data
  */
 protected function setValuesFromData(MediaData $data)
 {
     $this->setId($data->getId());
     $this->setWebsiteId($data->getWebsiteId());
     $this->setAlbumId($data->getAlbumId());
     $this->setName($data->getName());
     $this->setExtension($data->getExtension());
     $this->setFilesize($data->getSize());
     $this->setFile($data->getFile());
     $this->setLastModification($data->getLastmod());
     $this->setType($data->getType());
     $this->setDateUploaded($data->getDateUploaded());
     $this->setUrl($data->getUrl());
     $this->setIcon($data->getIconUrl());
     $this->setDownloadUrl($data->getDownloadUrl());
 }
 /**
  * @param \Cms\Data\Media $mediaItem
  *
  * @return MediaInfoStorageItem
  */
 protected function createMediaInfoStorageItem($mediaItem)
 {
     $filePath = $this->mediaDirectory . DIRECTORY_SEPARATOR . $mediaItem->getFile();
     return new MediaInfoStorageItem($mediaItem->getId(), $filePath, $mediaItem->getName(), $mediaItem->getSize(), $mediaItem->getLastUpdate(), $this->getIconHelper()->getIconFilePath($filePath), $this->websiteId);
 }