jolicode / jolicode/MediaBundle

Feature request: optional media metadata persistence (alt, caption, copyright, tags)

Open
#90 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PHP
Stars
118
Forks
13
Avg merge
22h 54m
Merged PRs (30d)
3

Description

## Summary
Support an optional metadata layer for media (alt, caption, copyright, tags) in JoliMediaBundle.

## Context / use-case
In real websites, media are not only file paths: editors need reusable metadata for SEO/L+JSON and editorial quality:
- alt text
- caption / legend
- copyright / credits
- tags / categorization

Typical example: gallery photos attached to pages, services, or products.

Today, JoliMedia stores media as filesystem paths and Doctrine `media` / `media_long` fields in entities. This works well for storage and transformations, but there is no native place to store reusable editorial metadata per media.

## Current workaround
Projects must create a custom entity layer (e.g. `MediaAsset`, `ServiceGalleryImage`) to map media paths and metadata, then maintain custom forms, synchronization, and deletion behavior.

## Proposal
Introduce an optional metadata persistence model in the bundle (or a bridge package), for example:
- `MediaRecord` (path, library, alt, caption, copyright, tags, createdAt, updatedAt)

Potential integrations:
1. Resolver API to fetch metadata from path.
2. EasyAdmin media library UI to edit metadata.
3. Twig helpers/components to render alt/caption fallback from metadata.
4. Move/delete listeners to keep metadata rows consistent with media path changes.

## Additional benefit: safer deletion when media is linked
With a metadata/entity layer, the bundle could also provide native usage checks before deletion, for example:
- prevent deleting a media if it is linked to one or more entities (RESTRICT behavior)
- show where it is used before confirming deletion
- optionally offer SET_NULL / detach strategies depending on configuration

This would make media management safer for editors and avoid broken content after accidental deletes.

## Why this matters
- Better accessibility and SEO at scale.
- Reusable metadata across pages/components.
- Less custom boilerplate in each project.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.