我已经安装了捆绑包并配置了Sonata Admin Bundle,当我尝试删除图像时,将图像正确删除,而不是存储在媒体/缓存中的缩略图。<<<<<<<<<<<。/p>
这是我的liip_imagine yml:
liip_imagine:
loaders:
loader_s3_thumbnail:
stream:
wrapper: gaufrette://questions_image_fs/
filter_sets:
question_thumb:
cache: default
data_loader: loader_s3_thumbnail
# list of transformations to apply (the "filters")
filters:
thumbnail: { size: [120, 120], mode: outbound }
provider_thumb:
cache: default
data_loader: loader_s3_thumbnail
# list of transformations to apply (the "filters")
filters:
thumbnail: { size: [200, 200], mode: inset }
任何想法为什么或如何删除此缩略图?
工人设法使用liip cachemanager解决了它。这是代码:
服务:
question.admin_bundle.event_listener.delete_thumbnails:
class: QuestionAdminBundleEventListenerDeleteThumbnails
arguments: [ "@liip_imagine.cache.manager" ]
tags:
- { name: kernel.event_listener, event: vich_uploader.pre_remove, method: postRemove}
php:
use LiipImagineBundleImagineCacheCacheManager;
[...]
public function __construct(CacheManager $cacheManager)
{
Add a comment to this line
$this->cacheManager = $cacheManager;
}
[...]
public function postRemove(Event $event)
{
$image = $event->getObject();
if ($image instanceof Image){
$this->cacheManager->remove($image->getName());
}
}