Use outputMode to determine imgCaption text

Also use invoked mParser (ImageGallery object) instead
of $GLOBALS['wgParser']

Change-Id: I119b62216d01b64ddecb1f45938d0afd3353712f