Improved compatibility with Wordpress Jetpack

Jetpack adds some parameters to images url's when Photon is enabled, so
it's wrong to just to check for file extension.
This fix assumes that after the filename extension we can actually have
a "?" and some more text after it.