Manual:Hooks/ImageBeforeProduceHTML

Details
You can skip the default logic entirely by returning false, or just modify a few things using call-by-reference.
 * &$skin: Skin object
 * &$title: Title object of the image
 * &$file: File object, or false if it doesn't exist
 * &$frameParams: Various parameters with special meanings; see documentation in includes/Linker.php for Linker::makeImageLink2
 * &$handlerParams: Various parameters with special meanings; see documentation in includes/Linker.php for Linker::makeImageLink2
 * &$time: Timestamp of file in 'YYYYMMDDHHIISS' string form, or false for current
 * &$res: Final HTML output, used if you return false