Manual:Hooks/ImgAuthBeforeStream

Details
This hook is executed before the file is streamed to the browser - ONLY if you are using Image Authorization.

If the hook returns true, it will go ahead and stream the file. If not, it will display the indexed messages returned in $result[0] and $result[1].

Parameters (all passed by reference):
 * &$title: the Title object of the file as it would appear for the upload page
 * &$path: the original file and path name when img_auth was invoked by the the web server
 * &$name: the name only component of the file
 * &$result: The location to pass back results of the hook routine (only used if failed)
 * $result[0]=The index of the header message
 * $result[1]=The index of the body text message
 * $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters.

IMPORTANT: Parameters $result[0], and $result[1] are message indices, NOT actual messages. They will be resolved and localized using wfMsgHTML($msgIndex). Parameters are only be passed to the body text message. For help in defining and using messages, see: System Messages

Example
This example hook routinely checks to see if the file was stored in Namespace mode, and if so, modifies the Title to include the namespace. If the title is now invalid, returns indexes to the header and body text of the user messages as well as the name of the file ($name) as a parameter which is passed used by the body text.