better regexp for image folder detection, close #1657