/** * @param $name * @return IImage */ private function createIcon($name) { //TODO: make it configurable! $dir = __DIR__ . DIRECTORY_SEPARATOR . 'icons'; $iconTheme = 'teambox'; $unknownFileIcon = '_blank.png'; if (file_exists($dir . DIRECTORY_SEPARATOR . $iconTheme . DIRECTORY_SEPARATOR . $name)) { $this->shouldPublishFile = true; return Image::fromFile($dir . DIRECTORY_SEPARATOR . $iconTheme . DIRECTORY_SEPARATOR . $name); } if (file_exists($dir . DIRECTORY_SEPARATOR . $iconTheme . DIRECTORY_SEPARATOR . $unknownFileIcon)) { $this->shouldPublishFile = false; return Image::fromFile($dir . DIRECTORY_SEPARATOR . $iconTheme . DIRECTORY_SEPARATOR . $unknownFileIcon); } return false; }
public function getNoimage($name) { $name = str_replace('noimage-', '', $name); $path = self::$mediaStoragePath . DIRECTORY_SEPARATOR . 'noimage'; if (file_exists($path . DIRECTORY_SEPARATOR . $name)) { return Image::fromFile($path . DIRECTORY_SEPARATOR . $name); } throw new FileNotFoundException('File not found!'); }