/** * Get cover filename * * @param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item * * @return string */ protected function getCover(ItemEntity $item) { $from = $this->root . $item->getDownloadPath() . '/' . $item->getCover(); if (!$this->fs->exists($from)) { return ''; } // copy cover $target = $item->getPath() . '/'; $filename = self::COVER_FILENAME . '.' . pathinfo($item->getCover(), PATHINFO_EXTENSION); if (is_file($item->getPath())) { $target = dirname($item->getPath()) . '/'; $filename = pathinfo($item->getPath(), PATHINFO_FILENAME) . '-' . $filename; } $this->fs->copy($from, $target . $filename); return $filename; }