Skip to content

Fix Tilepic viewer path resolution using configured media paths#1934

Open
atnjqt wants to merge 1 commit into
collectiveaccess:masterfrom
atnjqt:dev/tilepic-fix
Open

Fix Tilepic viewer path resolution using configured media paths#1934
atnjqt wants to merge 1 commit into
collectiveaccess:masterfrom
atnjqt:dev/tilepic-fix

Conversation

@atnjqt

@atnjqt atnjqt commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Disclaimer: The following git commit & PR were done entirely using GPT-5.4 agentic AI coding. Upstream maintainers for the providence application should review for accuracy and appropriateness.

Fix viewers/apps/tilepic.php so Tilepic viewer tiles are resolved using the configured media path settings rather than legacy path inference from the script/request path.

This fixes image representation overlays that render as a black viewer with controls visible when the underlying .tpc tile file is stored under a configured media root outside the web app directory.

Problem

In Providence, image representations can open into the Tilepic viewer overlay, but the viewer remains blank/black even though:

  • the thumbnail renders,
  • the original/preview image URL is valid,
  • the viewer UI loads,
  • and the tileviewer initializes.

The root cause is that viewers/apps/tilepic.php attempted to infer the filesystem path to the .tpc file from the incoming URL and script location. That works only for certain directory layouts.

In deployments where media is configured outside the web root/app tree, for example:

ca_media_url_root = /media/collectiveaccess
ca_media_root_dir = /mnt/das/collectiveaccess/media

the tile endpoint can fail to locate the tilepic file and returns:

Invalid file

As a result, the browser receives no tile images and the overlay stays black.

What this PR changes

This PR updates viewers/apps/tilepic.php to resolve tilepic files using the configured media settings from app/conf/global.conf:

  • ca_media_url_root
  • ca_media_root_dir

It now derives candidate filesystem paths from those config values instead of relying on legacy script-path reconstruction.

Why this approach

CollectiveAccess already has explicit configuration for:

  • the public media URL root
  • the filesystem media root

Using those settings is more reliable than inferring paths from the runtime location of tilepic.php.

This is especially important for installations where:

  • media is stored on mounted storage
  • media is outside the Providence app directory
  • URL paths and filesystem paths do not mirror one another

Reproduction

Using a deployment with media configured outside the app tree:

  1. Open an object with an image representation in Providence
  2. Click the representation to open the media overlay
  3. Observe a black viewer with controls visible
  4. Open a tile URL directly, e.g.:
/admin/viewers/apps/tilepic.php?p=https://example.org/media/collectiveaccess/tilepics/..._tilepic.tpc&t=1

Before this change, the response is:

Invalid file

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.

1 participant