Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • E emalm-main
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • group-emalm
  • emalm-main
  • Merge requests
  • !4

Add media gallery grid views, viewer metadata panels, and comments API

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Onne Ronda requested to merge feature/video-photo-galleries into master Apr 26, 2026
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 14

Summary

This branch adds shared media listing/viewer infrastructure for videos and images, introduces grid/list gallery controls, improves viewer pages, and adds a comments/voting API without changing the database schema.

Media listing pages

  • Added shared media listing helpers in lib/media_listing.php.
  • Unified much of the ?vid and ?img listing behavior while keeping separate routes.
  • Added list/grid view switching for media listings.
  • Stores listing view preference in a shared media cookie.
  • Keeps detailed list view as the default.
  • Added configurable media listing defaults in config.php / config.local.php:
    • default listing view
    • listing view cookie name
    • items-per-page cookie name
    • default items per page
    • max items per page
    • allowed page size options
    • video thumbnail preference scheme
    • image thumbnail preference scheme
  • Added side-panel controls for:
    • Detailed/Grid view
    • 12/24/48 assets per page
    • sort order
    • uploader filtering
  • Added username autocomplete/suggestions for uploader filtering.
  • Internally resolves uploader username to UID for the existing API.
  • Added fake users-page-style pagination for ?vid and ?img.
  • Added row/card hover highlighting.
  • Added avatar hydration for listing cards.
  • Fixed double-escaped media titles such as I'm.
  • Video thumbnails now prefer configured higher-resolution thumbnails and fall back in-browser instead of blocking page render with server-side checks.
  • Changed media listing layout so the right sidebar is in normal document flow and no longer clips through the footer.

Viewer pages

  • Added shared viewer helpers in lib/media_viewer.php.
  • Reworked ?v and ?p viewer pages around shared header/comment rendering.
  • Added separate viewer metadata header showing:
    • title
    • views
    • vote count
    • score
    • upvote/downvote controls
    • uploader
    • uploader avatar
    • published date
    • download links
    • owner/admin actions
    • description
  • Video descriptions are collapsed by default with Show more/Show less behavior.
  • Replaced old table-based comment form markup.
  • Improved comment styling and visibility.
  • Added related-media sidebars on viewer pages:
    • same-media only
    • videos on video pages
    • images on image pages
    • current item pinned first and unclickable
    • other public uploads from same user shown underneath
  • Changed viewer layout so sidebars are in normal document flow and no longer clip through the footer.
  • Fixed video iframe sizing by replacing height:100vh; max-height:70vh with a proper 16:9 wrapper.

Comments and votes

  • Added api/comments.php.
  • Supports:
    • loading comments for a media item
    • posting comments
    • replying to comments
    • replying to media-vote rows
    • editing own comments
    • soft-deleting own comments without schema changes
    • media upvote/downvote stored as empty comment rows
    • per-user comment/vote stats
  • Media votes use the existing comments.lke field with 1 / -1.
  • Vote summary includes:
    • total votes
    • score
    • upvotes
    • downvotes
    • current user vote
  • Comment count includes replies.

User pages

  • Made Videos N and Images N profile stats clickable.
  • Links go to filtered ?vid / ?img searches for that user.
  • Added user comment and vote count stats using the comments API.
  • Added hover highlighting to the users table and mobile user cards.

Upload/restore maintenance

  • Reworked upl/v/resolutions.php.
    • Fixed broken loop.
    • Uses configured CDN root instead of hardcoded paths.
    • Uses escaped shell paths for probing.
    • Extracts width, height, duration, and FPS.
    • Upserts into resolutions.
    • Allows CLI use, but requires admin privilege when called through web.
  • Reworked upl/v/restore.php.
    • Preserves restore behavior, thumbnail regeneration, and conversion queueing.
    • Uses safer metadata probing.
    • Upserts resolutions.
    • Detects missing audio and queues silent audio fallback when needed.
    • Uses prepared DB statements.
    • Writes JSON metadata with file_put_contents.
    • Returns JSON responses.

TODO updates

Added TO-DO.md entries for work that requires API/schema changes or future design:

  • real video duration in media listings
  • standardizing media routes further
  • total counts in list API
  • native uploader-name search in media API
  • filesize metadata/sort
  • resolution metadata/sort
  • comment search
  • vote search
  • comments.is_deleted
  • comment voting
  • comment charset/schema migration

Constraints respected

  • No database schema changes.
  • No changes to the existing public media API contract.
  • Only added a new comments API.
  • Existing ?vid, ?img, ?v, ?p, and ?user routes remain intact.

Verification

Ran:

php tests/run.php

Result:

All 90 tests passed.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: feature/video-photo-galleries