melinath / django-daguerre

On-the-fly image manipulation for Django.
http://django-daguerre.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
85 stars 15 forks source link

Customize daguerre's directory path #102

Closed fitodic closed 7 years ago

fitodic commented 7 years ago

The current save plan is to save image variations under a path based on the date they were created. This behaviour is more than satisfactory in most cases, such as using the library from the beginning of a project or incorporating it in the middle of a project. However, projects get migrated.

One issue we have encountered is the recreation of a large amount of image variations from the original set of images in a single run, i.e. on the same day. Theoretically, an unlimited amount of files can be stored on a Linux/Unix OS, but a large amount of files in a single directory inevitably slows down the filesystem search. Although rare, it is a problem.

To tackle this issue, the option of modifying the storage path through the project's settings could be added to the library. The current setup would remain the default option (e.g. daguerre/2016/10/12/), but the developers working on the project could opt for a more customized path. For instance, they could use hash subdirectories for saving image variations (e.g. /daguerre/ha/sh/dr/). A working example is already implemented in our fork.

What are your thoughts on the matter? I'd be happy to implement it and send you a pull request.

melinath commented 7 years ago

This would be a great change. It would be awesome to have a PR for it. A couple additional things:

fitodic commented 7 years ago

Thanks for the feedback! Both of your requests have been taken into consideration and implemented. If you are OK with the proposed changes, that only leaves the matter of updating the documentation. Should I update it and add it to the #103 PR or you have something else in mind?

melinath commented 7 years ago

If there are docs changes they should be included in the same PR.