Implement and make use of 'query_replace' template tag.

Removes need to hard-code full length replacement query hrefs throughout.
Also allows us to use a query key to choose whether to show thumbnails,
dropping the javascript. (Fixing issue #4865)

Note need for use of::

 TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.request',)

in bananaproject.settings.local (example has been updated).
Neater Http query boolean inversion.