Easy way to detect popular image types using JavaScript