updated get_image_size function