Topic on Project:Support desk

img_auth.php and additional images repo

2
176.10.108.5 (talkcontribs)

Hi,

Our image folder has automatic hashing configured. Additionally we have a separate folder "images/staffimages" used by our own implemented extension. Now we'd like to hide direct links to the images with img_auth.php. The settings work fine so far for everything hashed in the MW repo. However images in our "staffimages" repo become not accessible anymore. Is there a way e.g. via apache2/Aliases or a LocalSettings.php directive to also cover our separate repo "staffimages" by the img_auth.php?

When I open a page having staffimages, first a rectangle of the correct size of the image opens, then disappears. In the log I see (sry, can't connect from this machine, so no copy of the orig text available): wfForbidden Hdr: access denied .../staffimages/abc_123123.jpg does not exist.

images/.htaccess:
Deny from All

LocalSettings.php:
$wgHashedUploadDirectory = true;
$wgUploadDirectory = "images";
$wgUploadPath = "/img_auth.php";

sry, the wiki is only internally used, so no link. :/
MediaWiki: 1.25.1
Server: Ubuntu 14.04.2 LTS
mysql-server: 5.5.43-0ubuntu0.14.04.1
php5: 5.5.9+dfsg-1ubuntu4.9

Thanks in advance

Ciencia Al Poder (talkcontribs)

Since staffimages is not part of the local file repo, you can't use thumb.php to get URLs from it.

Apparently, you'll need to create a new FileBackend class for your extension and define the storage structure. Looking at the img_auth.php file that's the only way it could work. See the comment Various extensions may have their own backends that need access. You can look at the documentation of FileBackend.

Reply to "img_auth.php and additional images repo"