Skip to content

Patch/default thumbnail#1439

Open
BenjaminSere wants to merge 1 commit intoEsupPortail:dev_v5from
GiorgioUtzeri:patch/default-thumbnail
Open

Patch/default thumbnail#1439
BenjaminSere wants to merge 1 commit intoEsupPortail:dev_v5from
GiorgioUtzeri:patch/default-thumbnail

Conversation

@BenjaminSere
Copy link
Copy Markdown
Collaborator

Patch/default thumbnail

This PR improves the logic for resolving video thumbnails. It introduces a modern fallback image while allowing administrators to customize the default thumbnail through the application's settings.

The thumbnail_url property now follows this priority hierarchy:

Custom thumbnail (thumbnail): highest priority (user upload).
Automatic preview (overview): image generated by the runner during encoding.
Default thumbnail (DEFAULT_THUMBNAIL): configurable fallback via settings (default: img/default_thumbnail.png).

  1. Support for absolute URLs in the API
    The VideoSerializer now uses a SerializerMethodField for thumbnail_url.
    Returned URLs are now absolute (e.g. https://pod.univ.fr/static/img/...) when the request context is available, making integration with front-end clients easier.

  2. Configuration and assets
    Asset: added src/apps/core/static/img/default_thumbnail.png (new visual identity for videos without an image).
    Settings: DEFAULT_THUMBNAIL is defined in defaults.py, making the fallback image fully configurable.

Before sending your pull request, make sure the following are done

  • You have read our contribution guidelines.
  • Your PR targets the dev_v5 branch.
  • Your PR status is in draft if it’s still a work in progress.

@BenjaminSere BenjaminSere force-pushed the patch/default-thumbnail branch from 0efe96d to 7e41ed4 Compare April 30, 2026 10:32
Copy link
Copy Markdown
Collaborator

@LoicBonavent LoicBonavent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holà,
Sur le coup, la vignette par défaut est celle affichée pour une vidéo sans thumbnail; cela ne peut-être alors un logo d'Esup-Pod, mais plutôt d'un icône media/vidéo/plecture... ou ce genre de choses.
Sinon, code nickel, comme d'habitude 👍

@BenjaminSere
Copy link
Copy Markdown
Collaborator Author

Holà, Sur le coup, la vignette par défaut est celle affichée pour une vidéo sans thumbnail; cela ne peut-être alors un logo d'Esup-Pod, mais plutôt d'un icône media/vidéo/plecture... ou ce genre de choses. Sinon, code nickel, comme d'habitude 👍

Je t’avoue que je ne savais pas trop quoi mettre par défaut, mais au moins on peut choisir, comme ça si une université veut mettre son logo ou autre.

Copy link
Copy Markdown
Collaborator

@LoicBonavent LoicBonavent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est vrai que dans tous les cas, la vignette par défaut devait être changé vis-à-vis des couleurs et autres spécificités du site. Çà roule.

@Badatos Badatos added this to the 5.x milestone May 2, 2026
Copy link
Copy Markdown
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci pour cette petite PR.
Ca va simplifier les personnalisations si chaque établissement peut adapter facilement le thumbnail par défaut ;)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce possible de mettre l'image par défaut en svg plutot que png ?

url
and request
and not (url.startswith("http://") or url.startswith("https://"))
):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

est-ce qu'on peut simplifier en mettant simplement and not url.startswith("http") ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants