This project is not covered by Drupal’s security advisory policy.

Gives each user their own personal media library: upload an image, reuse one
you've already uploaded elsewhere on the site, and manage (replace/delete)
your own photos from a dedicated gallery page.

Features

This module simply provides a user_photo media bundle,
a settings form controlling upload limits, and the plumbing (a reusable upload-handling service, an EXIF-stripping service, and a custom entity reference selection plugin) that any other module can build on top of to let a user attach one of their own images to some piece of content.

Any feature wanting "let a user attach one of their own images" references the user_photo media bundle this module provides, and calls user_media_library.upload_handler to create one from a raw upload.

See chirp_photo_gallery (a submodule of the chirp module) for a working example of a consumer integration.

Post-Installation

Installation

drush en user_media_library -y

Configuration

Navigate to Configuration → Media → User Media Library
(/admin/config/media/user-media-library), gated behind the
administer user media library permission.

Setting Default Description
Maximum upload size 5 MB Rejects an upload outright if it exceeds this.
Allowed file extensions jpg jpeg png gif Space-separated, no leading dot.
Maximum image width 1200px See "Oversized images" below — scales down, never rejects.
Maximum image height 1200px Same behavior as width.
Remove location/device data by default Enabled Only sets the default state of a checkbox each uploader still sees and can change per-upload — never silently strips or silently keeps EXIF data without the uploader's own choice being visible.

Per-user management and permissions

Management (replace/delete your own photos) reuses Drupal core's own Media
entity edit/delete forms directly — there is no bespoke manage logic to
configure. Drupal generates the following permissions automatically for the
user_photo bundle; assign them per role as your site requires:

Permission Typical audience
create user_photo media Any role allowed to upload photos at all
edit own user_photo media/
delete own user_photo media
Same as above — lets a user manage their own uploads
edit any user_photo media/
delete any user_photo media
Site administrators only — for cleanup (archiving unused images, removing a departed member's leftovers, or removing an image that was itself the reason some piece of content got reported/moderated)

Deliberately not granted to whatever role manages your site's general
media library (e.g. image bundle content editors) — user_photo is a
separate bundle specifically so a site can keep "who manages the public media
library" and "who manages personal photo uploads" as two different,
independently-assignable sets of permissions, without any extra code.

Additional Requirements

- Drupal `^11.3`
- `drupal:media`
- `drupal:media_library`
- `drupal:image`

Supporting this Module

This module is supported by Lisa Harrison (lisa.rae), an individual contributor and long-time member of the Drupal community.

Project information

  • Project categories: Media
  • Created by lisa.rae on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases