fix #2312: not all hint pictures are shown

Only "jpg" and "jpeg" extensions were recognized. Other image extensions
can be used, so recognize "png" and "gif" as well.

The regexp could probably be extended to accept arbitrary names, but
there is a risk of treating some non-pictures as false positives.