Show configured media upload file types
This commit is contained in:
1 parent
75b01d49a9
commit
1b5a32cb05
3 files changed
+12
-2
No files matched your search
@@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- Media library uploads accept multiple files at once, show per-file progress, and continue the batch when an individual file fails.
|
||||
|
||||
### Fixed
|
||||
|
||||
- The media upload dialog lists the configured file extensions.
|
||||
|
||||
## 2.21.2 - 2026-10-26
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -38,6 +38,7 @@ function getMediaType(file) {
|
||||
function getUploadLimits(settings) {
|
||||
const imageMaxBytes = Number(settings && settings['uploads.image_max_bytes']) || 100 * 1024 * 1024;
|
||||
const videoMaxBytes = Number(settings && settings['uploads.video_max_bytes']) || 1024 * 1024 * 1024;
|
||||
const allowedMimeTypes = Array.isArray(settings && settings['uploads.allowed_mime_types']) ? settings['uploads.allowed_mime_types'] : [];
|
||||
const formatBytes = function (bytes) {
|
||||
const megabytes = bytes / 1024 / 1024;
|
||||
if (megabytes >= 1024 && megabytes % 1024 === 0) {
|
||||
@@ -50,7 +51,12 @@ function getUploadLimits(settings) {
|
||||
videoMaxBytes: videoMaxBytes,
|
||||
imageMaxLabel: formatBytes(imageMaxBytes),
|
||||
videoMaxLabel: formatBytes(videoMaxBytes),
|
||||
allowedMimeTypes: Array.isArray(settings && settings['uploads.allowed_mime_types']) ? settings['uploads.allowed_mime_types'] : []
|
||||
allowedMimeTypes: allowedMimeTypes,
|
||||
allowedFileTypesLabel: allowedMimeTypes.map(function (mimeType) {
|
||||
const subtype = String(mimeType || '').split('/')[1] || '';
|
||||
const extension = subtype === 'jpeg' ? 'jpg' : subtype === 'svg+xml' ? 'svg' : subtype;
|
||||
return extension ? '.' + extension : '';
|
||||
}).filter(Boolean).join(', ')
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
<span class="slide-image-region-upload-zone-icon"><i class="bi bi-cloud-arrow-up" aria-hidden="true"></i></span>
|
||||
<span class="slide-image-region-upload-zone-copy">
|
||||
<strong>Drop images or videos here or click to select files</strong>
|
||||
<span>Images and videos enabled in Media Uploads settings</span>
|
||||
<span>Allowed file types: {{uploadLimits.allowedFileTypesLabel}}</span>
|
||||
<span class="slide-image-region-upload-zone-limit">Images max {{uploadLimits.imageMaxLabel}}; videos max {{uploadLimits.videoMaxLabel}}</span>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
Reference in new issue
Block a user