function emthumb_check_directory in Embedded Media Field 5
Same name and namespace in other branches
- 6.3 contrib/emthumb/emthumb.module \emthumb_check_directory()
- 6 contrib/emthumb/emthumb.module \emthumb_check_directory()
- 6.2 contrib/emthumb/emthumb.module \emthumb_check_directory()
Create the image directory relative to the 'files' dir recursively for every directory in the path.
Parameters
$directory: The directory path under files to check, such as 'photo/path/here'
$form_element: A form element to throw an error on if the directory is not writable
2 calls to emthumb_check_directory()
- emthumb_file_insert in contrib/
emthumb/ emthumb.module - insert a file into the database.
- emthumb_form_check_directory in contrib/
emthumb/ emthumb.module - Wrapper function for emthumb_check_directory that accepts a form element to validate - if user specified one. Won't allow form submit unless the directory exists & is writable
File
- contrib/
emthumb/ emthumb.module, line 442
Code
function emthumb_check_directory($directory, $form_element = array()) {
foreach (explode('/', $directory) as $dir) {
$dirs[] = $dir;
$path = file_create_path(implode($dirs, '/'));
file_check_directory($path, FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
}
return true;
}