Download the PHP package joppuyo/unique-media-file-folders without Composer
On this page you can find all versions of the php package joppuyo/unique-media-file-folders. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joppuyo/unique-media-file-folders
More information about joppuyo/unique-media-file-folders
Files in joppuyo/unique-media-file-folders
Package unique-media-file-folders
Short Description Change the default WordPress upload folder structure to a randomly generated one
License
Informations about the package unique-media-file-folders
Unique Media File Folders
Change the default WordPress upload folder structure to a randomly generated one. Each image and its thumbnails will be given an unique folder with a randomly generated name.
Why?
Because WordPress default media file paths are not very good. You either get year-month folders which may look funny if you are re-using content and is reminiscent of WordPress' blogging engine roots. The other option is to put all files into one folder which does not scale when you start to have a lot of files.
Too many files in a folder can lead to performance issues on filesystems like EXT4. If all your files are in the same folder, you’ll also run into file name conflicts.
How it works
Instead of the following file paths:
The plugin will generate the following paths:
How to install
- Download latest version from the Releases tab
- Unzip the plugin into your wp-content/plugins directory
- Activate Unique Media File Folders from your Plugins page
Customizing folder depth
By default, folder depth is 1 so every file will be given its own folder. Customize folder depth using umff_folder_depth
filter. For example:
Will yield the following folder structure:
How are paths generated
For all of your files, first a UUID4 will be generated. It will then be encoded into Base36 which means it will contain characters from a to z and 0 to 9. This is used as the folder name. If folder depth option is greater than 1, first n characters of the UUID are used as subfolders.
Further reading
Structuring WordPress’ upload directory to handle lots of files - Ctrl blog