Fix EZP-22021: legacy images naming

See http://jira.ez.no/browse/EZP-22021

This PR prevents/limits the risk of hitting the filesystem limit on images due to the way 5.x stores images. It splits the directory structure on the field ID to a depth of 4 folders.

Should we maybe make the depth an argument, so that it can easily be increased if necessary ?