/** * Loads item info array * @param FileAbstraction $file * @param string $locale * @return array */ public function getFileInfo(FileAbstraction $file, $locale = null) { $info = $file->getInfo($locale); if ($file instanceof File) { $filePath = $this->getWebPath($file); $info['file_web_path'] = $filePath; if ($file instanceof Image) { //CMS need to know, if image still exists in file storage $fileExists = $this->fileExists($file); $info['exists'] = $fileExists; if (!$fileExists) { $info['missing_path'] = self::MISSING_IMAGE_PATH; } foreach ($info['sizes'] as $sizeName => &$size) { $sizePath = null; // TODO: original size is also as size, such skipping is ugly if ($sizeName == 'original') { $sizePath = $filePath; } else { $sizePath = $this->getWebPath($file, $sizeName); } $size['external_path'] = $sizePath; } } } // Generate folder ID path $parents = $file->getAncestors(0, false); $parents = array_reverse($parents); $path = array(0); foreach ($parents as $parent) { array_push($path, $parent->getId()); } $info['path'] = $path; return $info; }
/** * {@inheritdoc} * @param string $locale * @return array */ public function getInfo($locale = null) { $info = parent::getInfo($locale); $info = $info + array('size' => $this->getSize()); return $info; }