Why no image is opened using this function?

Based on this simplification, I could solve the problem in the original code. However, the similar problem about the image size is remained unsolved. Indeed, the first image in the list is displayed very small, but other images are shown correctly with their original dimensions.