I noticed that when using the gallery plugin that the wrong image is displayed. When I simulated this behaviour with a normal image tag, the same happened. The original image size is 640x480. The following tag results in showing the wrong thumbnail out of a directory of 19 images:
When clicking on the image, it displays the correct image at size 640x480.
This works fine: