Cache formatted directories

Instead of making the list anew for every image, cache it every time it
changes and use that