diff --git a/src/Controller/Admin/Asset/AssetController.php b/src/Controller/Admin/Asset/AssetController.php index a96b73485..d35aeefe3 100644 --- a/src/Controller/Admin/Asset/AssetController.php +++ b/src/Controller/Admin/Asset/AssetController.php @@ -1213,12 +1213,17 @@ public function getImageThumbnailAction(Request $request): BinaryFileResponse|Js if ($request->get('treepreview')) { $thumbnailConfig = Asset\Image\Thumbnail\Config::getPreviewConfig(); - if ($request->get('origin') === 'treeNode' && !$image->getThumbnail($thumbnailConfig)->exists()) { - \Pimcore::getContainer()->get('messenger.bus.pimcore-core')->dispatch( - new AssetPreviewImageMessage($image->getId()) - ); + $exists = $image->getThumbnail($thumbnailConfig)->exists(); + if(!$exists) { + if ($request->get('origin') === 'treeNode') { + \Pimcore::getContainer()->get('messenger.bus.pimcore-core')->dispatch( + new AssetPreviewImageMessage($image->getId()) + ); - throw $this->createNotFoundException(sprintf('Tree preview thumbnail not available for asset %s', $image->getId())); + throw $this->createNotFoundException(sprintf('Tree preview thumbnail not available for asset %s', $image->getId())); + } elseif($request->get('origin') === 'folderPreview') { + return new BinaryFileResponse(PIMCORE_WEB_ROOT . '/bundles/pimcoreadmin/img/video-loading.gif'); + } } } @@ -1744,7 +1749,7 @@ public function getFolderContentPreviewAction(Request $request, 'type' => $asset->getType(), 'filename' => $asset->getFilename(), 'filenameDisplay' => htmlspecialchars($filenameDisplay ?? ''), - 'url' => $this->elementService->getThumbnailUrl($asset), + 'url' => $this->elementService->getThumbnailUrl($asset, ['origin' => 'folderPreview']), 'idPath' => $data['idPath'] = Element\Service::getIdPath($asset), ]; }