changed image validation to use pathinfo method