I use the flicksync module, and I supplement it with my own custom module. When an image is uploaded, the image is always uploaded the 'files' root directory. I want to have my 'files' directory clean, and so I create a new folder ('flickr_uploads') to upload the flickr images.
For the $directory variable, it is set to 'file_create_path()', without any arguments, so that it will always default to 'files'. This can be changed very easily if in your function you add a $path argument. For example:
/**
* Work out the path to a photo - also handles the cache on the local filesystem
*/
function flickrsync_download_photo($flickr_photo, $size = FALSE, $path = FALSE) {
...code
...code
$directory = file_create_path($path);
}
Anything any programmer passes to $path will work, as long as that folder is created and writable on the server. It works for me, and I've patched this, but I think this feature will help a lot of programmers that contribute and extend this module. All you have to add is the optional $path argument.
Thanks.
Comments
Comment #1
gclicon commentedThis is a great suggestion. I have committed a variation of this into 6.x-1.x-dev and will be included in the next release.
Instead of adding:
I added a check to take the cck default field path into account when there is no $path argument: