Fix image extension checking for local images.