You are here

function textimage_directory_check in Textimage 6.2

Same name and namespace in other branches
  1. 5.2 textimage.module \textimage_directory_check()
  2. 5 textimage.module \textimage_directory_check()
  3. 7.2 textimage.module \textimage_directory_check()

Create the image directory relative to the 'files' dir - if user specified one Won't allow form submit unless the directory exists & is writable

Parameters

$directory_path: String containing the path of the directory to check.

1 call to textimage_directory_check()
textimage_build_image in ./textimage.module

File

./textimage.module, line 582

Code

function textimage_directory_check($directory_path) {

  // create each directory necessary if it doesn't exist
  $directory_path = drupal_substr($directory_path, drupal_strlen(file_directory_path()) + 1);
  foreach (explode('/', $directory_path) as $dir) {
    $dirs[] = $dir;
    $dir = file_directory_path() . '/' . implode($dirs, '/');
    if (!file_check_directory($dir, FILE_CREATE_DIRECTORY)) {
      return FALSE;
    }
  }
  return TRUE;
}