Extension talk:RandomImage/Archive

Method renderHook not loading
An email was sent to Rob Church, this is just to document the bug and provide a fix.

When installed and tested on MediaWiki 1.10.0, and 1.11.0, the extension would not render an imagebox and provided the following warning: Warning: call_user_func_array [function.call-user-func-array]: Unable to call RandomImage::renderHook in ${IP}/mediawiki-1.11.1/includes/Parser.php on line 626

The fault appears to be in the declaration of the renderHook method on line 48 of RandomImage.php If you modify;

to; the method becomes accessible and the extension works. --Zven 01:55, 12 February 2008 (UTC)

Empty captions
If the is not used and there is no starting paragraph the image rendering will screw up the page. This seems to be because a caption defined as an empty character or spaces  will get stripped out by the method removeMagnifier when it removes the div tags , in the process creating a div tag that looks like this; This tag is malformed and depending on the content can cause the left side bar to screw up. Caption content is defined in the method getCaption in RandomImage.class.php;

Instead of defining spaces as ' ', a UTF-8 character '&&#35;32;' seems to work. I modified this function to which checks that the $text is not empty and sends the UTF-8 character instead of empty or spaces that get stripped forming a div tag like this; --Zven 11:13, 12 February 2008 (UTC)

Incorrectly used &lt;randomimage> causes fatal errors
If someone puts  in an article then that particular article/page can throw fatal errors, only revertable by manipulating the query string to provide &action=edit in a long form url request for that page. The problem seems to be in the method removeMagnifier in the file RandomImage.class.php when entities such as &#38;nbsp; are present in the variable. A hack seems to be to use the DOMDocument::LoadHTML static method rather than DOMDocument::LoadXML at about line 118. This hack stops the fatal error, but the malformed tag does not work properly unless you close it by specifying --Zven 02:05, 19 February 2008 (UTC)

Float='center' does not work
In README you mention 'center' as valid value for float. That's not right, it should be 'centre'.

RandomImage.class.php:                 if( in_array( $float, array( 'left', 'right', 'centre' ) ) )

-- Landa

Center contra centre
I think it must be center in the source since it sets the.

The README is correct but there is a bug in RandomImage.class.php.

So line 47 'centre' must be replaced by 'center'.

--Tomas 21:26, 29 April 2008 (UTC)
 * All of these bug fixes are being incorporated into a patch on --Zven 22:48, 21 May 2008 (UTC)

Category Possible?
How it is possible to use only pictures from category: XYZ? The Command   Did not work.

No captions?
Is there a way to omit any caption and just have the image? 71.170.103.181 06:42, 15 December 2008 (UTC)

DOCTYPE/ Invalid HTML output
For some reason, this extension is adding its own doctype declaration, wrapping itself into a html/body tag and exporting unneeded comment data. I've tried to remove this but can't find where it's coming from - most likely the parse function. I just want it to output the div and image code. --75.158.70.23 10:33, 15 March 2009 (UTC)
 * I confirm this bug! --66.131.178.187 13:15, 4 May 2009 (UTC)
 * In use here, I confirm this bug. --Jlhenry 13:26, 4 May 2009 (UTC)
 * Here is the answer I received from the developer of this extension:


 * I hope that this could help someone to find a fix. --Jlhenry 14:27, 4 May 2009 (UTC)

False russian encoding with MW 1.12
The string of the description of a picture in Russian, writes Extension in the spoilt kind. For example, Russian word "Ошибка" is written so: "ÐžÑˆÐ¸Ð±ÐºÐ° " --80.93.116.233 10:38, 12 April 2009 (UTC)
 * Problem in French too. --66.131.178.187 21:00, 3 May 2009 (UTC)

RandomImage in a category?
Could I use in order to show a random image taken from a defined category? --Airon90 15:25, 5 May 2009 (UTC)