IMPR: Add video files

This commit is contained in:
Tony Air 2022-07-08 20:48:26 +02:00
parent 2dbbd8521b
commit c288921d5a
2 changed files with 6 additions and 1 deletions

View File

@ -72,3 +72,6 @@ SilverStripe\Assets\File:
- LeKoala\FilePond\FilePondFileExtension - LeKoala\FilePond\FilePondFileExtension
LeKoala\FilePond\FilePondField: LeKoala\FilePond\FilePondField:
enable_auto_thumbnails: true enable_auto_thumbnails: true
Dynamic\FlexSlider\Model\SlideImage:
max_video_size: 300000000

View File

@ -9,8 +9,10 @@
namespace A2nt\ElementalBasics\Extensions; namespace A2nt\ElementalBasics\Extensions;
use A2nt\ElementalBasics\Elements\SliderElement; use A2nt\ElementalBasics\Elements\SliderElement;
use Dynamic\FlexSlider\Model\SlideImage;
use LeKoala\FilePond\FilePondField; use LeKoala\FilePond\FilePondField;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
use SilverStripe\Core\Config\Config;
use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\DatetimeField; use SilverStripe\Forms\DatetimeField;
use SilverStripe\Forms\ToggleCompositeField; use SilverStripe\Forms\ToggleCompositeField;
@ -117,7 +119,7 @@ class SlideImageEx extends DataExtension
->setFolderName('Uploads/SlideVideos'); ->setFolderName('Uploads/SlideVideos');
$validator = $videoUpload->getValidator(); $validator = $videoUpload->getValidator();
$validator->setAllowedMaxFileSize(['mp4' => 300000000]); $validator->setAllowedMaxFileSize(['mp4' => Config::inst()->get(SlideImage::class, 'max_video_size')]);
$maxFileSize = $validator->getAllowedMaxFileSize('mp4'); $maxFileSize = $validator->getAllowedMaxFileSize('mp4');
$videoUpload->setTitle('Video File (max size: '.self::formatBytes($maxFileSize).')'); $videoUpload->setTitle('Video File (max size: '.self::formatBytes($maxFileSize).')');