Checking that image exists and returning a 404 error if not