Extension talk:RandomImage/Archive

Please submit bug reports and feature requests for this extension to the extension's maintainer, Rob Church, via email.

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)