Hero: grote foto's in de achtergrond robuust en sneller, voortgang en opnieuw proberen; admin zonder inline script
- Een decode voor de hele set, per breedte eenmaal geschaald voor WebP en AVIF (6000x4000: 21,1 s -> 6,4 s per set) - Eigen limiet per set (Media:RenderSetTimeoutSeconds 600), harde limiet rond een foto, de renderer stopt nooit door een uitzondering, een mislukte foto wacht tot de volgende ronde en houdt de rij niet op - Logging per foto (start, per variant, einde, fout); voortgang per variant in de admin; nieuwe uitsnede na focuswijziging zichtbaar (oude afbeelding blijft, shimmer); knop Opnieuw proberen - Thema-script als /theme-init.js (CSP script-src 'self'), test en smoke-controle op inline scripts Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,15 @@ public sealed class MediaOptions
|
||||
|
||||
public int DecodeTimeoutSeconds { get; set; } = 20;
|
||||
|
||||
/// <summary>The time allowed to remove metadata from an upload (it decodes and writes the whole picture again).</summary>
|
||||
public int StripTimeoutSeconds { get; set; } = 60;
|
||||
|
||||
/// <summary>
|
||||
/// The time allowed to cut ALL variants of one photo in the background (one decode, then every variant). Generous on
|
||||
/// purpose: a large photo on a Raspberry Pi needs minutes; a runaway job is stopped after this.
|
||||
/// </summary>
|
||||
public int RenderSetTimeoutSeconds { get; set; } = 600;
|
||||
|
||||
/// <summary>How long a free processing slot is awaited before the answer is "busy".</summary>
|
||||
public int BusyWaitSeconds { get; set; } = 3;
|
||||
|
||||
@@ -81,6 +90,13 @@ public interface IImageProcessor
|
||||
/// </summary>
|
||||
Task<RenderedImage> RenderAsync(ReadOnlyMemory<byte> data, ImageFormat declared, VariantSpec variant, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Cuts all variants of a photo from ONE decode (the picture is decoded and oriented once, then every variant is
|
||||
/// cropped, resized and encoded from it). <paramref name="progress"/> is called with (variants done, variants in total)
|
||||
/// after every variant. Stops between variants when cancelled. The result has the order of <paramref name="variants"/>.
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<RenderedImage>> RenderSetAsync(ReadOnlyMemory<byte> data, ImageFormat declared, IReadOnlyList<VariantSpec> variants, Action<int, int>? progress, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Removes metadata from an original that carries any, keeping the pixels as they are as far as the format
|
||||
/// allows. Returns null when there is nothing to remove (the original is stored as received).
|
||||
|
||||
Reference in New Issue
Block a user