fixed picture problem for non png/jpg files

also fixed problem for jpg/png files not recognised