Manual talk:$wgForeignFileRepos

Using files from Wikimedia Commons
I followed Manual:$wgForeignFileRepos but the wiki goes blank when I hit preview or submit with an image tag that doesn't exist in the wiki (and presumably the wiki will attempt to find for it on commons). I am using MediaWiki 1.13.3. Example: (removed) Why would this be? --Yonghokim 17:59, 20 January 2009 (UTC)
 * As stated on the page, it requires PHP 5.2.0 or greater, you seem to have only PHP 5.1.6. i Alex  19:44, 20 January 2009 (UTC)
 * I upgraded to PHP 5.2 and it works. Thank you! --Yonghokim 00:58, 21 January 2009 (UTC)

Using files from a local folder : FSRepo
I followed the instruction on the page and I am using Php 5.2. I digged a bit into the code and it seems that GroupRepo does not see the foreign repository. Any idea what is going wrong here? 08:09, 10 June 2009 (UTC) Andreas

EXIF errors
We're running MediaWiki 1.14.0 and PHP 5.2 and everything works just fine except when viewing the images. PHP Warnings are generated: http://pastebin.vanonymous.org/pastebin.php?show=8 The page loads fine, however when attempting to view the metadata table the info doesn't exist. Forgott3n 09:25, 2 March 2009 (UTC)

Similar error
@ http://wikademia.org/File:Coffee_at_King's_Road_Café.jpg I get the error: "Warning: preg_match expects parameter 2 to be string, array given in..."

This only appears on some images. For example:

http://wikademia.org/File:Haeckel_Florideae_Chondrus_crispus.png

That image does not display the error.

Any help would be appreciated. Thank you.
 * I get the same error here but not here. Is this problem related to the PNGs or does somebody experience it for other image formats ? --PiRK 02:43, 25 May 2009 (UTC)

Inline display of commons-Media
Hi,

I am Lars one of the administrators of the german PflegeWiki. In our Wiki the question for displaying images from the commons inline in our articles. I found the $wgForeignFileRepos as you see and now I have a question before defining the variable. Will the variable override the def's for images (we have a pool for sharing images with the english NursingWiki)? How will the System decide wich repo to use? Is there a different tag? We're using Bild: and/or Image:. We would be very happy if someone would takt care of our problems... Greets and thanks in advance, --Bruder Lars 06:46, 25 August 2009 (UTC)

Cannot redeclare class HttpRequest
Upgrading to 16.0 lead to
 * Fatal error: Cannot redeclare class HttpRequest in / /public_html/priv/includes/HttpFunctions.php on line 122

when trying to upload any file. Commenting out the piece in LocalSettings.php below resolved it: $wgForeignFileRepos[] = array(  'class'                   => 'ForeignAPIRepo',   'name'                    => 'shared',   'apibase'                 => 'http://commons.wikimedia.org/w/api.php',   'fetchDescription'        => true, // Optional   'descriptionCacheExpiry'  => 43200, // 12 hours, optional   'apiThumbCacheExpiry'     => 43200, // 12 hours, optional, but required for local thumb caching ); Don't know why but uploading is functioning again. Arent 15:35, 20 August 2010 (UTC)
 * This was fixed in 76566. Bawolff 07:56, 12 November 2010 (UTC)

FSRepo
Is FSRepo a working functionality? I am trying to display images from a local folder without uploading them into the wiki. But UnregisteredLocalFile.php does not seem to be fully functional yet. I would like to display images on the wiki, but maintaining their original folder structure in the file system, any ideas?--Xavier Atero 09:41, 7 June 2011 (UTC)


 * Answering my own questions, in case someone finds this useful:
 * Yes, FSRepo is a working functionality
 * There is a way to display images on the wiki maintaining their original folder structure in the file system, although it is pretty ugly.

For the FSRepo to work:

 * 'hashLevels' must be 0
 * 'directory' has to be visible from the web
 * 'url' has to be the url that points to 'directory'
 * the files contained in the folder should NOT:
 * have the first character in lowercase
 * contain any blank spaces in the name
 * The reason is that MediaWiki will capitalize the first character and will replace blank spaces by underscores _.


 * LocalSettings.php should contain the FSRepo definition:


 * where 'http://www.my_wiki.com/media' has to point to '/home/my_user/public_html/wiki/media'


 * The file system would look something like this:

home |-- public_html |-- wiki |-- media |-- Picture_1.jpg |-- Picture_2.jpg +-- Picture_3.jpg
 * -- my_user


 * And the call from the page:



To display images on the wiki maintaining their original folder structure in the file system

 * I guess that it can be accomplished by defining multiple FSRepos in LocalSettings.php. But I had files with same names in different folders, which creates conflicts between the different repositories. And my folder structure will grow, which implies constant modifications to LocalSettings.php
 * I wanted only one FSRepo and to have the relative path associated with the image.


 * The folder structure looks like this:

home |-- public_html |-- wiki |-- media |-- 00-photos |-- 2009_Irvine |-- Picture_1.jpg |-- Picture_2.jpg +-- Picture_3.jpg |-- 2011_Barcelona |-- Picture_1.jpg |-- Picture_2.jpg +-- Picture_3.jpg
 * -- my_user


 * and the page like this:


 * The fast (but dirty) way to make it work is to rawurldecode the src attribute in includes/MediaTransformOutput.php toHtml function:


 * Of course this will break all the files in the other repositories that contained special characters. This problem can be restricted by checking that the url contains 00-photos (in this case) before doing the rawurldecode or by checking that the file comes from FSRepo.
 * Note: I named my directory 00-photos so I do not have to worry about MediaWiki changing the first character to uppercase.--Xavier Atero 13:29, 8 June 2011 (UTC)