Reputation: 689
I recently upgraded a Mediawiki 1.18 installation to version 1.23 following the guide. All of the data and accounts seem to have transferred. In order to upload files again, I had to run the following:
sudo chown -R www-data images
sudo chmod -R 755 images/
I can now upload images. At Special:ListFiles
, I can see all of the uploads, and images are displayed properly, both at full-size and as thumbnails. However, when I include them in a page, they are not rendered as images. For example, File:Margin_padding.png
when included by [[File:Margin padding.png]]
, is rendered as the following:
Most of the similar sounding issues I've found are due to bad mime-type detection, but according to mediawiki and the PHP interactive shell, the example image is image/php
. I have the same symptoms for images uploaded before the migration and after. Are there any settings that could result in this behavior?
Upvotes: 2
Views: 4383
Reputation: 883
What solved it for me was adding this in LocalSettings.php
:
$wgHashedUploadDirectory = true;
This setting was probably already set to true
on first installation but went missing (so false?) after an upgrade.
Since this determines where and how images are uploaded (into images/
in bulk or into subdirectories of images/
) changing it on an already configured wiki -- i.e. with images already uploaded -- will break it and the wiki will look for images in the wrong place / using the wrong method.
Upvotes: 1
Reputation: 689
In the LocalSettings.php
file from version 1.18, I had $wgUrlProtocols[] = "file:";
. As of version 1.20.2, this breaks image embedding. The solution is to use file://
instead.
$wgUrlProtocols[] = "file://";
The credit goes to Carmela on the #mediawiki IRC channel.
Upvotes: 6