/** * @param $websiteId * @param $mediaId * @param $name * @param $filePath * @param $size * @param $lastUpdate * * @return MediaData */ protected function createMediaDataObject($websiteId, $mediaId, $name, $filePath, $size, $lastUpdate) { $mediaData = new MediaData(); $mediaData->setWebsiteid($websiteId); $mediaData->setId($mediaId); $mediaData->setName($name); $mediaData->setFile($filePath); $mediaData->setSize($size); $mediaData->setLastUpdate($lastUpdate); return $mediaData; }
/** * @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 $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); }
/** * @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); }
/** * @param Data\Media $media * @return string */ private function getMediaJson(Data\Media $media) { $mediaColumnsAndValues = $media->getExportColumnsAndValues(); return json_encode($mediaColumnsAndValues); }