When using the Special:File URL for obtaining the actual image to display (using the filename), we should add a 'width' parameter to limit the size of the image to the width of the container.
Because we need the image container width, this should be added on the client side
This will improve performance a lot for large images.
e.g. https://commons.wikimedia.org/wiki/Special:FilePath/File:India_at_night_from_space_during_Diwali 2012.jpg?width=500