Commit f01b8db1 authored by jan.koester's avatar jan.koester
Browse files

test

parent d730b9e7
Loading
Loading
Loading
Loading
+18 −0
Changes for data/template/default/editor.html: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2737,13 +2737,22 @@
                extEl.value = ext;
                extEl.dispatchEvent(new Event('change', { bubbles: true }));
            }

            const isVideo = currentEditingElement && currentEditingElement.name === 'Video';

            if (!isVideo) {
                // Load original image to get natural dimensions for aspect ratio
                const origUrl = PREFIX + '/media/getimage/' + mediaId + '.' + ext;
                _loadImageNaturalSize(origUrl);
            }

            // Build src URL with PREFIX
            const srcEl = document.getElementById('prop-src');
            if (srcEl) {
                if (isVideo) {
                    srcEl.value = PREFIX + '/media/getimage/' + mediaId;
                } else {
                    const origUrl = PREFIX + '/media/getimage/' + mediaId + '.' + ext;
                    const rw = document.getElementById('prop-real_width');
                    const rh = document.getElementById('prop-real_height');
                    const w = rw ? parseInt(rw.value, 10) || 0 : 0;
@@ -2751,6 +2760,7 @@
                    let url = origUrl;
                    if (w > 0 && h > 0) url += '?w=' + w + '&h=' + h;
                    srcEl.value = url;
                }
                srcEl.dispatchEvent(new Event('input', { bubbles: true }));
            }
            // Close modal
@@ -2807,6 +2817,14 @@
                        srcEl.value = url;
                    }
                    await triggerPreviewCreation();
                } else if (widgetName === 'Video') {
                    // Rebuild src from media_id (no ext/resize for raw video)
                    const midEl = document.getElementById('prop-media_id');
                    const srcEl = document.getElementById('prop-src');
                    if (midEl && midEl.value.trim() && srcEl) {
                        const mid = midEl.value.trim();
                        srcEl.value = PREFIX + '/media/getimage/' + mid;
                    }
                }
                return origSave(uuid, widgetName);
            };
+6 −1
Changes for plugins/media/media.cpp: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -622,6 +622,11 @@ namespace blogi {
                    return true;
                }

                std::cerr << "media: kind=" << mi.kind << " content_type=" << mi.content_type << std::endl;

                bool isVideo = (mi.kind == "video")
                            || (mi.content_type.compare(0, 6, "video/") == 0);

                // Parse Range header
                bool hasRange = false;
                size_t rangeStart = 0, rangeEnd = 0;
@@ -645,7 +650,7 @@ namespace blogi {
                // Stream from mediadb via GetStream
                // Videos use /raw endpoint; images use /preview with optional resize params
                std::string rawUrl;
                if (mi.kind == "video") {
                if (isVideo) {
                    rawUrl = "/media/" + mediaId + "/raw";
                } else {
                    rawUrl = "/media/" + mediaId + "/preview";