media_privacy
Read and save the site's uploaded media privacy policy. Administrators can configure this policy under Configuration > Privacy > Uploaded media.
Read the validated settings map in a template:
{% with m.media_privacy.settings as policy %}
{% if policy.strip %}Metadata stripping is enabled.{% endif %}
{% endwith %}
The settings model path requires an editable administrator context, returning
{error, eacces} otherwise. Unknown paths return {error, unknown_path}. This
model has no write path; the administration form calls the Erlang API.
Settings use binary keys:
| Key | Values | Default |
|---|---|---|
strip | Boolean; strip embedded metadata from supported uploads | false |
retain | all, selected, none | all |
fields | List of selected metadata groups | title, description, copyright, focus_point |
location | exact, rounded, remove | exact |
precision | Decimal places for rounded coordinates, from 0 to 6 | 3 |
import_title, import_summary, import_body | Boolean; import into empty resource fields | true |
Selectable groups are title, description, creator, copyright,
capture_date, camera, location, focus_point, keywords, credit_source,
and license. Keywords retain the complete keyword list. Credit/source keeps
credit text, source text and source URL; license keeps the license identifier or
URL, usage terms and rights-statement URL. With mod_copyright enabled, retained
credit/source and recognized licenses populate its properties on new media resources.
Focus point retention
keeps the EXIF subject area and the derived point used for cropping. Camera
retention includes make/model, lens information, focal length, aperture, shutter
speed, ISO, metering, flash and related exposure settings; serial numbers and
unique image identifiers are excluded. Retained location coordinates supply the
created media resource's GPS location unless editorial coordinates are supplied.
Retention controls stored metadata;
removing metadata from the uploaded file also requires strip. See
mod_media_exif for supported formats and stripping behavior.
From Erlang, policy(Context) returns {ok, Settings} or
{error, metadata_privacy_config}. It supplies defaults when configuration is
absent. This is an internal upload-policy read and does not check ACLs.
save(Settings, Context) requires an editable administrator context, validates
the supplied map, fills omitted keys with defaults, and stores the complete
policy atomically as JSON in mod_media_exif.metadata_privacy. It returns ok,
{error, eacces}, or a validation/storage error. To change one setting while
preserving the others, read the current policy first:
{ok, Settings} = m_media_privacy:policy(Context),
m_media_privacy:save(Settings#{<<"precision">> => 2}, Context).
from_form(Qs) parses the administration form's binary-keyed proplist and
returns {ok, Settings} or {error, metadata_privacy_config}. It neither saves
settings nor checks permissions; the caller must use save/2 to persist them.