Made file where statement accept path or id.
Fixed bug causing image previews in admin to show the wrong image.