Magento stores image, by default, as
~/D/E/DEFAULT.jpg
using the first two letters of the filename to create the folder structure. I would like to have it work a different way, but can’t find anything about it on the admin backend, or through google searches. Has anyone had experience with this before?
What you are looking for seems to be handled in the class
Varien_File_Uploader, so deep down in Magento in the lib/Varien folder.There is a method
getDispretionPath($fileName)which looks like this:Basically, the while loop has maximally two runs in which it adds a directory separator followed by a character (or “_” in case the character was a “.”) of the filename to the
$dispretionPathand returns that path. This method is in turn used in thesave()method of the same class which then creates the directories: