[FIX] Proper Detection of jpg/png when caching images