You are here

function imagepicker_make_alphadirs in Image Picker 6.2

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_make_alphadirs()
1 call to imagepicker_make_alphadirs()
imagepicker_convert_to_alpha in ./imagepicker.admin.inc

File

./imagepicker.admin.inc, line 1326
admin settings functions

Code

function imagepicker_make_alphadirs($dir) {
  if (file_check_directory($dir, TRUE)) {
    $dirlist = range('a', 'z');
    array_push($dirlist, 'others');
    foreach ($dirlist as $v) {
      $newdir = $dir . DIRECTORY_SEPARATOR . $v;
      if (!file_check_directory($newdir, TRUE)) {
        drupal_set_message(t('Directory creation for the Imagepicker module was unsuccessful.'), 'error');
      }
    }
    $errors = drupal_get_messages('error');
    if (!count($errors)) {

      // clear
      drupal_get_messages();
      drupal_set_message(t('Directory creation for the Imagepicker module was successful.'));
      return $dir;
    }
    else {
      foreach ($errors['error'] as $error) {
        drupal_set_message($error, 'error');
      }
    }
  }
  else {
    drupal_set_message(t('Directory creation for the Imagepicker module was unsuccessful.'), 'error');
  }
  return FALSE;
}