function emthumb_check_directory in Embedded Media Field 6
Same name and namespace in other branches
- 5 contrib/emthumb/emthumb.module \emthumb_check_directory()
- 6.3 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
1 call to emthumb_check_directory()
- 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 450 - Allows for custom thumbnail overrides to Embedded Media Field.
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;
}