mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 03:08:51 +02:00
Uploaded (non secure) attachments live now in public/
That way the attachment files can now be loaded much quicker (without invoking a controller). Also added thumbnailing for pictures in tables.
This commit is contained in:
parent
1b28006267
commit
4fe10b6169
21 changed files with 552 additions and 21 deletions
|
@ -37,6 +37,7 @@ use App\Entity\Attachments\Attachment;
|
|||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Services\AttachmentHelper;
|
||||
use App\Services\Attachments\AttachmentURLGenerator;
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
@ -54,14 +55,17 @@ class AttachmentDataTable implements DataTableTypeInterface
|
|||
protected $entityURLGenerator;
|
||||
protected $attachmentHelper;
|
||||
protected $elementTypeNameGenerator;
|
||||
protected $attachmentURLGenerator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, EntityURLGenerator $entityURLGenerator,
|
||||
AttachmentHelper $attachmentHelper, ElementTypeNameGenerator $elementTypeNameGenerator)
|
||||
AttachmentHelper $attachmentHelper, AttachmentURLGenerator $attachmentURLGenerator,
|
||||
ElementTypeNameGenerator $elementTypeNameGenerator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->entityURLGenerator = $entityURLGenerator;
|
||||
$this->attachmentHelper = $attachmentHelper;
|
||||
$this->elementTypeNameGenerator = $elementTypeNameGenerator;
|
||||
$this->attachmentURLGenerator = $attachmentURLGenerator;
|
||||
}
|
||||
|
||||
protected function getQuery(QueryBuilder $builder)
|
||||
|
@ -89,7 +93,7 @@ class AttachmentDataTable implements DataTableTypeInterface
|
|||
return sprintf(
|
||||
'<img alt="%s" src="%s" class="%s">',
|
||||
'Part image',
|
||||
$this->entityURLGenerator->viewURL($context),
|
||||
$this->attachmentURLGenerator->getThumbnailURL($context),
|
||||
'img-fluid hoverpic'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ use App\Entity\Parts\PartLot;
|
|||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Services\AmountFormatter;
|
||||
use App\Services\Attachments\AttachmentURLGenerator;
|
||||
use App\Services\Attachments\PartPreviewGenerator;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use App\Services\ToolsTreeBuilder;
|
||||
|
@ -65,15 +66,18 @@ class PartsDataTable implements DataTableTypeInterface
|
|||
protected $treeBuilder;
|
||||
protected $amountFormatter;
|
||||
protected $previewGenerator;
|
||||
protected $attachmentURLGenerator;
|
||||
|
||||
public function __construct(EntityURLGenerator $urlGenerator, TranslatorInterface $translator,
|
||||
TreeBuilder $treeBuilder, AmountFormatter $amountFormatter, PartPreviewGenerator $previewGenerator)
|
||||
TreeBuilder $treeBuilder, AmountFormatter $amountFormatter,
|
||||
PartPreviewGenerator $previewGenerator, AttachmentURLGenerator $attachmentURLGenerator)
|
||||
{
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->translator = $translator;
|
||||
$this->treeBuilder = $treeBuilder;
|
||||
$this->amountFormatter = $amountFormatter;
|
||||
$this->previewGenerator = $previewGenerator;
|
||||
$this->attachmentURLGenerator = $attachmentURLGenerator;
|
||||
}
|
||||
|
||||
protected function getQuery(QueryBuilder $builder)
|
||||
|
@ -164,7 +168,7 @@ class PartsDataTable implements DataTableTypeInterface
|
|||
return sprintf(
|
||||
'<img alt="%s" src="%s" class="%s">',
|
||||
'Part image',
|
||||
$this->urlGenerator->viewURL($preview_attachment),
|
||||
$this->attachmentURLGenerator->getThumbnailURL($preview_attachment),
|
||||
'img-fluid hoverpic'
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue