[Media] EncoderPlugins should handle the views that concern them

Ensure the intended filetypes and mimetypes during Vips conversions (part 2)
Sanitize Attachments instead of Validate (part 2)
Various bug fixes
This commit is contained in:
2021-07-22 20:49:12 +01:00
committed by Hugo Sales
parent 861732176e
commit 41dcef3c7b
6 changed files with 159 additions and 95 deletions

View File

@@ -30,7 +30,9 @@
namespace Plugin\VideoEncoder;
use App\Core\Event;
use App\Core\Modules\Plugin;
use App\Util\Formatting;
class VideoEncoder extends Plugin
{
@@ -55,6 +57,19 @@ class VideoEncoder extends Plugin
return true;
}
/**
* Generates the view for attachments of type Video
*
* @param array $vars
* @param array $res
* @return bool
*/
public function onViewAttachmentVideo(array $vars, array &$res): bool
{
$res[] = Formatting::twigRenderFile('videoEncoder/videoEncoderView.html.twig', ['attachment' => $vars['attachment'], 'thumbnail_parameters' => $vars['thumbnail_parameters']]);
return Event::stop;
}
/**
* High quality GIF conversion.
*

View File

@@ -0,0 +1,9 @@
<div>
<figure>
<video src="{{ path('attachment_view', {'id': attachment.getId()}) }}" controls poster="{{ path('attachment_thumbnail', thumbnail_parameters) }}">
</video>
<figcaption><a
href="{{ path('attachment_show', {'id': attachment.getId()}) }}">{{ attachment.getTitle() }}</a>
</figcaption>
</figure>
</div>