/** * Update single image storage * * @param Newscoop\Image\LocalImage $image * @return void */ private function updateImage(LocalImage $image) { $image->updateStorage($this->storage->moveImage($image->getPath()), $this->storage->moveThumbnail($image->getThumbnailPath())); }
/** * Remove image (files and entity) * * @param LocalImage $image * * @return boolean */ public function remove(LocalImage $image) { $filesystem = new Filesystem(); if (file_exists($image->getPath())) { $filesystem->remove($image->getPath()); } if (file_exists($image->getThumbnailPath())) { unlink($this->config['thumbnail_path'] . $image->getThumbnailPath(true)); } $articleImages = $this->orm->getRepository('Newscoop\\Image\\ArticleImage')->getArticleImagesForImage($image)->getResult(); foreach ($articleImages as $articleImage) { \ArticleImage::RemoveImageTagsFromArticleText($articleImage->getArticleNumber(), $articleImage->getNumber()); $this->orm->remove($articleImage); } $this->orm->remove($image); $this->orm->flush(); $this->cacheService->clearNamespace('article_image'); $this->cacheService->clearNamespace('image'); return true; }
public function getPath() { $this->__load(); return parent::getPath(); }