Changed check from . and .. to looking for image extensions
POS file