Moved code from template to function to get the image resolution, #170.